0

我有以下问题:

我有一个 RawContactID 并想获取有关此联系人的所有信息。我运行这样的查询:

String selection = ContactsContract.RawContactsEntity.RAW_CONTACT_ID +" = ?";
String[] selectionArgs = new String[]{contacts[0].get(0)};
Cursor cursor = getContentResolver().query(ContactsContract.Data.CONTENT_URI, null, selection, selectionArgs, null);

之后,我通过许多 elseif 语句运行光标以区分不同的 MIME 类型并读取信息。工作正常,除此之外,它只是读取有关一个联系人的信息的非常多的代码,但没关系。

问题是 Mobilephonenumber 和 Telephonenumber 的 MIME-Type相同(vnd.android.cursor.item/phone_v2)?

我如何区分这些不同的信息?

任何提示都非常感谢!

4

1 回答 1

2

ContactsContract.CommonDataKinds.Phone会让你区分类型。其中有一长串,TYPE_HOME只有TYPE_MOBILE两个。

sdk 参考还指出

You can use all columns defined for ContactsContract.Data as well as the following aliases.

于 2010-12-31T14:45:09.943 回答