I'm trying to display contact information, and from another question on stackOverflow I've got the following snippet
String[] projection = new String[] {
ContactsContract.Contacts.DISPLAY_NAME,
ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME,
ContactsContract.CommonDataKinds.Email.DISPLAY_NAME
};
Uri contacts = ContactsContract.Contacts.CONTENT_LOOKUP_URI;
//id of the Contact to return.
long id = 3;
//Make the query.
Cursor managedCursor = managedQuery(contacts,
projection, // Which columns to return
null, // Which rows to return (all rows)
// Selection arguments (with a given ID)
ContactsContract.Contacts._ID = "id",
// Put the results in ascending order by name
ContactsContract.Contacts.DISPLAY_NAME + " ASC");
It seems that the managedQuery has been changed in 2.2 (I belive the original question where I got this was referenced to 2.0)
What has changed in 2.2? I can't find a way of displaying emails, phone numbers etc for a contact
EDIT : This is all I can find from the android debugging logs
08-24 20:49:51.893: ERROR/DatabaseUtils(519): Writing exception to parcel
08-24 20:49:51.893: ERROR/DatabaseUtils(519): java.lang.IllegalArgumentException: URI: content://com.android.contacts/contacts/lookup, calling user: com.example.android.contactmanager, calling package:com.example.android.contactmanager
08-24 20:49:51.893: ERROR/DatabaseUtils(519): at com.android.providers.contacts.LegacyApiSupport.query(LegacyApiSupport.java:1911)
08-24 20:49:51.893: ERROR/DatabaseUtils(519): at com.android.providers.contacts.ContactsProvider2.query(ContactsProvider2.java:4697)
08-24 20:49:51.893: ERROR/DatabaseUtils(519): at android.content.ContentProvider$Transport.bulkQuery(ContentProvider.java:150)
08-24 20:49:51.893: ERROR/DatabaseUtils(519): at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:111)
08-24 20:49:51.893: ERROR/DatabaseUtils(519): at android.os.Binder.execTransact(Binder.java:288)
08-24 20:49:51.893: ERROR/DatabaseUtils(519): at dalvik.system.NativeStart.run(Native Method)