开发者

Invalid column in contacts

开发者 https://www.devze.com 2023-02-20 13:23 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号