Invalid column in contacts
I am planning to create cursorjoiner for my app. I would l开发者_如何学编程ike to join the Display name and Email id using the cursorjoiner. I am trying on Android 1.6.
When I query for the Email Id list, I get an exception as :
03-30 13:08:15.609: ERROR/AndroidRuntime(302): Caused by: java.lang.IllegalArgumentException: Invalid column person
My code is as below
String[] projection1 = new String[] {
People._ID,
People.DISPLAY_NAME
} ;
String[] projection2 = new String[] {
Contacts.ContactMethods.PERSON_ID,
Contacts.ContactMethods.DATA
} ;
Cursor cur = cr.query(People.CONTENT_URI, projection1, null, null, null);
Cursor emailCur = cr.query( Contacts.ContactMethods.CONTENT_EMAIL_URI,
projection2,
null, null, null);
I checked the docs it says PERSON_ID
is a valid entry.
Also, if I use the same column as a parameter inside a query it works.
emailCur = cr.query( Contacts.ContactMethods.CONTENT_EMAIL_URI,
projection2,
Contacts.ContactMethods.PERSON_ID + " = ?",
new String[]{id}, null);
Can any one tell what parameter should I use in projection to achieve this.
Contacts is depreciated, use ContactsContract instead.
精彩评论