• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Cursormanagement in Service-Class

Hello there!
big_smile.png


I'm currently working on a Service, which extracts all information from the Contacts app (e.g. name, number, email, etc).
Now, I've been searching a while and the best tutorial I came across is the following: Working with the ?ContactsContract? to query contacts in Android APP-SOLUT APPLICATION-SOLUTIONS | The Android and iPhone Developer, Tutorial and App News Blog

The basic idea is to use a Contact-Provider, as only they can give you access to content information of another app.

Now, to access a contact-Provider you 1) first need the CONTENT_URI and then 2) need to create a cursor to access content.
The Cursor is created via the 'managedQuery(...) - Method', whch is only given for Activities. However, I'm implementing a service, so using managedQuery results in an error shown by Eclipse.


So, my question is: Is there any alternative to creating cursors rather than with the managedQeury method?


Open for all comments and suggestions
smile.png
 
Ok.. i figured it out.
Just use:
getContentResolver().query()
and don't forget to close the cursor with
cursorname.close().

Voil
 
Back
Top Bottom