I'm working on Android 4.2.2.
Say I have a contact called "Home". I use a basic contact picker such as:
Intent pickContactIntent = new Intent(Intent.ACTION_PICK, Uri.parse("content://contacts"));
...and then in the onActivityResult I get the contact URI:
String contactUri = data.getDataString();
Let's say it comes back with content://com.android.contacts/data/10855
.
But now in another part of the application, I'm watching for incoming calls. When the call comes in I'm trying to find the calling contact URI:
Cursor c = context.getContentResolver().query(
Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(phone_nbr)),
new String[] {PhoneLookup.LOOKUP_KEY,PhoneLookup._ID},
null, null, null);
I was guessing that the 10855 would be in either LOOKUP_KEY or _ID. It happens to be neither, so I guess I'm going about it the wrong way. Can someone advise?
Thanks!