Logcat says “invalid column data1”

后端 未结 2 522
慢半拍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.

    0 讨论(0)
  • 2020-12-11 06:59

    replacingContactsContract.CommonDataKinds.Phone.NUMBER with ContactsContract.PhoneLookup.NORMALIZED_NUMBER may help. Logcat says column name "data1" is invalid.

    0 讨论(0)
提交回复
热议问题