聯繫人API,存在查詢在RawContact
臺的接觸之間的差,並且在Contacts
表(如下圖所示:Data.RAW_CONTACT_ID
或Data.CONTACT_ID
):
在這種情況下,我可以檢索聯繫人ID ,並在其他情況下,我會檢索一個raw_contact ID? 例如,如果我們想要選擇一個聯繫人,它是否會返回我的查詢的raw_contact_id或contact_id?返回raw_contact_id或contacts_id?在聯繫人API的Android
下面是從文檔代碼:
Query
Finding all Data of a given type for a given contact
Cursor c = getContentResolver().query(Data.CONTENT_URI,
new String[] {Data._ID, Phone.NUMBER, Phone.TYPE, Phone.LABEL},
Data.CONTACT_ID + "=?" + " AND "
+ Data.MIMETYPE + "='" + Phone.CONTENT_ITEM_TYPE + "'",
new String[] {String.valueOf(contactId)}, null);
Finding all Data of a given type for a given raw contact
Cursor c = getContentResolver().query(Data.CONTENT_URI,
new String[] {Data._ID, Phone.NUMBER, Phone.TYPE, Phone.LABEL},
Data.RAW_CONTACT_ID + "=?" + " AND "
+ Data.MIMETYPE + "='" + Phone.CONTENT_ITEM_TYPE + "'",
new String[] {String.valueOf(rawContactId)}, null);
感謝
這個問題已經在這裏討論: http://stackoverflow.com/questions/4302279/android-contacts-raw-contact-id-vs -contact-id – elijah 2012-01-05 06:51:09
@elijah:謝謝,我沒有看到這個主題,謝謝發貼 – Paul 2012-01-05 18:37:34