Created
December 21, 2011 12:20
-
-
Save elyezer/1505833 to your computer and use it in GitHub Desktop.
Find a contact name from phone number in Android
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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