I would like to retrieve the name of the contact associated with an 
incoming message number. I came up with the following code.

Uri lookupUri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, 
Uri.encode(msgSender));
        Cursor c = getContentResolver().query(lookupUri, new 
String[]{Contacts.DISPLAY_NAME},null,null,null);

        try {
            c.moveToFirst();
            displayName = c.getString(0);
        } catch (Exception e) {
            // TODO: handle exception
        }finally{
            c.close();
        }

The problem is, its working on emulator but not working on my mobile 
device. I tried restarting my phone. But still not working. I searched and 
found codes similar to this one but is not working on actual phone.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to