Home > Android Dev > “Phone Number Lookup” for Android phones

“Phone Number Lookup” for Android phones

A small tiny Android application “Phone Number Lookup”.

This application addresses partial feature which native android contacts app don’t have.

“Phone NumberLookup”, is a very tiny app which find the name for the corresponding number entered in the search box. wondering why would one need this feature?
ever had a look at telephone/mobile monthly invoice which shows only the dialed numbers not dialed names.

when users want to know which dialed number belongs to whom then open “Phone Number Lookup” enter the number n hit the Lookup button and there you go…

isn’t this application simple and very useful

Checkout the screen shots from Google’s Nexus One device.

aNrstr = “11833”;
ListView lw = (ListView) findViewById(R.id.ListView01);

if(aNrstr.length()>0){
ContentResolver cr = getContentResolver();
Uri uri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(aNrstr));
Cursor cursor = cr.query(uri, null, null, null,null);

startManagingCursor(cursor);
String[] from = { PhoneLookup.NUMBER, PhoneLookup.DISPLAY_NAME};
int[] to = { R.id.textValue, R.id.textName};

SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, R.layout.row, cursor, from, to);
lw.setAdapter(adapter);

Advertisements
Categories: Android Dev
  1. January 18, 2011 at 12:46 am

    Hi,great post, do you know how to do a SQL LIKE similar search (or regex) in Contacts using ContactsContract? I've searched everywhere but don't find any explanation. It seems I should use CONTENT_FILTER_URI somehow but all examples just have full strings. I wanna search partial, like what if 0012345678 calls me and I have +1-234-567-89 saved. I don't wanna do 5 different cursor calls.Cheers materiper

  2. January 18, 2011 at 11:06 am

    Hi Riper,Partial search is possible on following conditions.Searching is started using last digits not from the beginning.i;e +1-234-567-89 is saved as contact and you search with pattern 23456789. i,e first 9 then 8 then 7…..2 based on the number saved in contacts and its length the content uri return the string.I have updated the screenshot for above scenario. Cheout the images nrs in image gallery secondly, telephony is capable of resolving "-" and "+"

  3. August 3, 2011 at 9:33 am

    Is there anyway to do partial number search?

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: