Hi all

 I am trying to get contact information from the contact database using 
ContentResolver with these field want to get name, number, 
FORMATTED_ADDRESS, PHOTO details for a contact in one single query.

So basically I need to make 3 queries per contact to obtain these details.

What I want to know is that, is there a simpler and more efficient way to 
achieve what this.

but using the below code i am getting exception.

java.lang.IllegalArgumentException: Invalid column data1
Can any body help me for finding the solution for the same.

Uri uri                = ContactsContract.Contacts.CONTENT_URI;
String[] projection    = new String[] { ContactsContract.Contacts._ID,
                                        
ContactsContract.Contacts.DISPLAY_NAME,
                                        
ContactsContract.CommonDataKinds.Phone.NUMBER,
                                        
ContactsContract.CommonDataKinds.StructuredPostal.FORMATTED_ADDRESS,
                                        
ContactsContract.CommonDataKinds.Photo.PHOTO};
String selection       = ContactsContract.Contacts.HAS_PHONE_NUMBER + " = 
'1'";
String[] selectionArgs = null;
String sortOrder       = ContactsContract.Contacts.DISPLAY_NAME + " COLLATE 
LOCALIZED ASC";

Cursor contacts          = getContentResolver().query(uri, projection, 
selection, selectionArgs, sortOrder);

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to