Android的联系人RAW_CONTACT_ID VS CONTACT_ID [英] Android Contacts RAW_CONTACT_ID vs CONTACT_ID
本文介绍了Android的联系人RAW_CONTACT_ID VS CONTACT_ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用的是联系人选择器,如下所示:
I am using a contact picker as follows:
Intent contactPickerIntent = new Intent(Intent.ACTION_PICK,
Contacts.CONTENT_URI);
startActivityForResult(contactPickerIntent, CONTACT_PICKER_RESULT)
我想知道的是返回的URI的最后一个路径段是否在 CONTACT_ID
或 RAW_CONTACT_ID
在情况下,它是 CONTACT_ID
,我该如何检索所有 RAW_CONTACT_ID
- 从这个联络?
In case it is the CONTACT_ID
, how do I retrieve all RAW_CONTACT_ID
s from this contact?
推荐答案
您将得到CONTACT_ID作为返回数据。
You will get CONTACT_ID as the return data.
在情况下,如果你需要得到的名单都在这里接触的RAW_CONTACT_ID是你可以包括在
In case if you need to get the list of all the RAW_CONTACT_ID of the contact here is what you can include in
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if ((requestCode == 1) && (resultCode == RESULT_OK)){
Uri contactData = data.getData();
// This gives the value of Contact URI
Cursor c = managedQuery(RawContacts.CONTENT_URI, new String[] {RawContacts._ID}, RawContacts.CONTACT_ID + " = " + contactData.getLastPathSegment(), null, null);
// This query would give you list of Raw_COntact_ID for the added contact
}
}
这篇关于Android的联系人RAW_CONTACT_ID VS CONTACT_ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文