Skip to content

Instantly share code, notes, and snippets.

@elyezer
Created December 21, 2011 12:20
Show Gist options
  • Save elyezer/1505833 to your computer and use it in GitHub Desktop.
Save elyezer/1505833 to your computer and use it in GitHub Desktop.
Find a contact name from phone number in Android
Uri uri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(phoneNumber));
String[] projection = {PhoneLookup.DISPLAY_NAME};
Cursor c = contentResolver.query(uri, projection, null, null, null);
if (c.moveToFirst()) {
name = c.getString(c.getColumnIndex(PhoneLookup.DISPLAY_NAME));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment