【发布时间】:2014-03-19 02:09:58
【问题描述】:
我正在使用 Android 4.2.2。
假设我有一个名为“家”的联系人。我使用基本的联系人选择器,例如:
Intent pickContactIntent = new Intent(Intent.ACTION_PICK, Uri.parse("content://contacts"));
...然后在 onActivityResult 我得到联系人 URI:
String contactUri = data.getDataString();
假设它返回 content://com.android.contacts/data/10855。
但现在在应用程序的另一部分,我正在监视来电。当来电时,我正在尝试查找来电联系人 URI:
Cursor c = context.getContentResolver().query(
Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(phone_nbr)),
new String[] {PhoneLookup.LOOKUP_KEY,PhoneLookup._ID},
null, null, null);
我猜测 10855 将位于 LOOKUP_KEY 或 _ID 中。碰巧两者都不是,所以我想我走错了路。有人可以建议吗?
谢谢!
【问题讨论】:
标签: android android-intent contacts