Logcat says “invalid column data1”

后端 未结 2 528
慢半拍i
慢半拍i 2020-12-11 06:14

New to threading. New to SQL. New to getting Contact Info. So of course I\'m lost. If I\'m reading this logcat correctly, it\'s telling me that either: column data1 does

2条回答
  •  长情又很酷
    2020-12-11 06:48

    To retrieve phone numbers, query Phone.CONTENT_URI and include Phone.NUMBER in your projection.

    To retrieve email addresses, query Email.CONTENT_URI and ask for Email.DATA in your projection.

    Either of those will also allow you to include Contacts.DISPLAY_NAME in your projection as well, as some common columns like that are automatically joined in.

    While I have not retrieved this data by ID before, I believe that your "where clause" would be Phone.CONTACT_ID + " = " + contactId and Email.CONTACT_ID + " = " + contactId respectively. See How to get contacts' phone number in Android for more.

提交回复
热议问题