Reputation: 3679
I'm able to retrieve the display name of contact using the id Code as follows:
Uri uri = ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, selectedid);
Cursor cur = managedQuery(uri, null, null, null, null);
startManagingCursor(cur);
cur.moveToNext();
String mname = cur.getString(cur.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
Where the "selectedid" is my id of the contact to be retrieved. Now i have a problem in retrieving the phone number from that id.
If possible can u type me the code which i have to add to get the phone number from that id
Upvotes: 1
Views: 711
Reputation: 11537
Have you tried:
String number = cur.getString(cur.getColumnIndex(
ContactsContract.CommonDataKinds.Phone.NUMBER));
Upvotes: 1