Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
James Elsey
Ranch Hand
Posts: 228
Android IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
Ankit Garg
Sheriff
Posts: 9510
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic