我一直在尝试通过其名称获取联系电子邮件,但遇到了一些困难。这是我尝试这样做的方法:
Cursor emailCur = cr.query(
ContactsContract.CommonDataKinds.Email.CONTENT_URI, null,
ContactsContract.CommonDataKinds.Email.DISPLAY_NAME + " = ?",
new String[] { contactName }, null);
while (emailCur.moveToNext()) {
String email = emailCur
.getString(emailCur
.getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA));
String emailType = emailCur
.getString(emailCur
.getColumnIndex(ContactsContract.CommonDataKinds.Email.TYPE));
}
emailCur.close();
我经常遇到异常,我做错了什么?
现在我的光标循环的迭代为零。