根据电话号码查找人名

// Android 1.6 and earlier (backwards compatible for Android 2.0+) 
Uri uri = Uri.withAppendedPath(Contacts.Phones.CONTENT_FILTER_URL, Uri.encode(phoneNumber)); 
 
// Android 2.0 and later 
Uri uri = Uri.withAppendedPath(ContactsContract.PhoneLookup.CONTENT_FILTER_URI, Uri.encode(phoneNumber)); 
 
// Query the filter URI 
String[] projection = new String[]{ PhoneLookup.DISPLAY_NAME, ... 
Cursor cursor = context.getContentResolver().resolver.query(uri, projection, ... 

 

你可能感兴趣的:(android)