HI,
我可以使用以下方法获取联系人光标:
Cursor cursor = context.getContentResolver().query(People.CONTENT_URI,
new String[] {People._ID, People.PRIMARY_EMAIL_ID},
selection, null, null);
然后我尝试使用以下方式获取实际的电子邮件地址:
String emailID = cursor.getString(PEOPLE_PRIMARY_EMAIL_ID_INDEX);
if (Integer.parseInt(emailID) != -1) {
Cursor cursor2 = context.getContentResolver().query(Uri.withAppendedPath(ContactMethods.CONTENT_URI, emailID), new String[] {ContactMethods.DATA}, null, null, null);
// cursor2 count is always 0
}
}
任何人都有任何想法?
答案 0 :(得分:2)
这是未经测试的,但也许是这样的?
Cursor cursor2 = context.getContentResolver().query(ContactMethods.CONTENT_EMAIL_URI, new String[] { ContactMethods.DATA }, "contact_methods._id=?", new String[] { emailID }, null);