Pages

Get it free, Try now

Free Cell Phones

Thursday, September 16, 2010

“Phone Number Lookup” for Android phones

A small tiny Android application "Phone Number Lookup".
[gallery]
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 [slideshow]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);

4 comments:

  1. 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 mate
    riper

    ReplyDelete
  2. 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 "+"

    ReplyDelete
  3. Is there anyway to do partial number search?

    ReplyDelete


  4. Really i am impressed from this post....the person who created this post is a genius and knows how to keep the readers connected..



    Find Phone Number

    ReplyDelete