我试图检查联系人列表中存在的号码,我使用下面的代码,但我总是在这一行得到错误
Cursor cur = this.getContentResolver().query(lookupUri,mPhoneNumberProjection, null, null, null);
谁能帮我找出问题所在,我已经允许在清单中阅读我的联系人
public String getContactName(String number)
{
String name = null;
Uri lookupUri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(number));
String[] mPhoneNumberProjection = { PhoneLookup._ID, PhoneLookup.NUMBER, PhoneLookup.DISPLAY_NAME };
Cursor cur = this.getContentResolver().query(lookupUri,mPhoneNumberProjection, null, null, null);
try
{
if (cur.moveToFirst())
{
name = cur.getString(cur.getColumnIndex(PhoneLookup.DISPLAY_NAME));
return name;
}
}
finally
{
if (cur != null)
cur.close();
}
return "unknown number";
}
这是我的错误日志!