I am using a contact picker as follows:
Intent contactPickerIntent = new Intent(Intent.ACTION_PICK,
Contacts.CONTENT_URI);
startActivityForResult(contactPickerIntent, CONTACT_PICKER_RESULT)
What I want to know is whether the last path segment of the returned URI is the CONTACT_ID
or the RAW_CONTACT_ID
.
In case it is the CONTACT_ID
, how do I retrieve all RAW_CONTACT_ID
s from this contact?
You will get CONTACT_ID as the return data.
In case if you need to get the list of all the RAW_CONTACT_ID of the contact here is what you can include in
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if ((requestCode == 1) && (resultCode == RESULT_OK)){
Uri contactData = data.getData();
// This gives the value of Contact URI
Cursor c = managedQuery(RawContacts.CONTENT_URI, new String[] {RawContacts._ID}, RawContacts.CONTACT_ID + " = " + contactData.getLastPathSegment(), null, null);
// This query would give you list of Raw_COntact_ID for the added contact
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With