File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Android and the fly likes How to query for contacts information? Docs are not updated to 2.2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "How to query for contacts information? Docs are not updated to 2.2" Watch "How to query for contacts information? Docs are not updated to 2.2" New topic
Author

How to query for contacts information? Docs are not updated to 2.2

James Elsey
Ranch Hand

Joined: Dec 21, 2007
Posts: 228

Hello

I'm working my way through the tutorials on the Android website, I'm looking at the contacts manager

I've also checked out the sample code for this.

I am trying to use managedQuery to obtain various columns of data, such as name, email, postal code.

I have the following snippet of code for doing this, but its currently throwing an error in eclipse


The error that I can gather from LogCat is as follows, not sure how relevant it is to this issue :




I've checked the documenation/examples on the documentation website, but it seems it is out of date (suggests to use deprecated methods and such)

Can anyone please help me with the above code snippet? I can get it to work if I only display ContactsContract.Contacts.DISPLAY_NAME

Regards


Kind Regards, James. OCPJP 1.6 || My SCJP / OCJCP Study Notes
Interested in : SCJP, Google App Engine, Stripes, Android;|| My Bite-Size SCJP Study Blog
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9302
    
  17

If you want to get the Name and Email of contacts, then you can use ContactsContract.CommonDataKinds.Email content provider instead of ContactsContract.Contacts provider. See this tutorial too...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to query for contacts information? Docs are not updated to 2.2