I am creating an application that is supposed to start a service which should access to a content provider in android and send some data to an external server.开发者_Python百科
When accessing the content provider, I need to use the managedQuery function, which has to be called in an Activity. How should I address this issue?
I don't know whether to create another Activity class in order to write the Content Provider access method here.
How should I send the data to the server, from the Service itself?
Not sure if I explained myself clearly..
Thanks a lot in advance!
I think you need the ContentResolver class:
ContentResolver cr = getContentResolver();
Cursor c = cr.query(uri, projection, selection, selectionArgs, sortOrder);
// do something
c.close();
加载中,请稍侯......
精彩评论