public String getPeople(String mNumber) {
String name = "";
String[] projection = { ContactsContract.PhoneLookup.DISPLAY_NAME,
/*ContactsContract.CommonDataKinds.Phone.NUMBER*/};
Cursor cursor = this.getContentResolver().query(
ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
projection,
ContactsContract.CommonDataKinds.Phone.NUMBER + " = '" + mNumber + "'",
null,
null);
if( cursor == null ) {
return "";
}
for( int i = 0; i < cursor.getCount(); i++ )
{
cursor.moveToPosition(i);
int nameFieldColumnIndex = cursor.getColumnIndex(ContactsContract.PhoneLookup.DISPLAY_NAME);
cursor.getColumnIndex(ContactsContract.PhoneLookup.DISPLAY_NAME);
name = cursor.getString(nameFieldColumnIndex);
Log.i(TAG, "lanjianlong" + name + " .... " + nameFieldColumnIndex); // 这里提示 force close
break;
}
if(cursor != null){
cursor.close();
}
return name;
}