1

I am trying to get rawcontacts._ID from contacts provider by using the lookup key and contact id stored in the application.

This function exists that might help me but I am not sure how to construct the rawContactUri

public static Uri getContactLookupUri (ContentResolver resolver, Uri rawContactUri)

Build a CONTENT_LOOKUP_URI style Uri for the parent ContactsContract.Contacts entry of the given ContactsContract.RawContacts entry.

Community
  • 1
  • 1
androiduae
  • 153
  • 2
  • 9

1 Answers1

0
    ContentResolver cr = getBaseContext()
                    .getContentResolver();
            Cursor cur = cr
                    .query(ContactsContract.Contacts.CONTENT_URI,
                            null,
                            null,
                            null,
                            null);

            if (cur.getCount() > 0) {

                Log.i("Content provider", "Reading contact  emails");

                while (cur
                        .moveToNext()) {

                    String contactId = cur
                            .getString(cur
                                    .getColumnIndex(ContactsContract.Contacts._ID));
                      }
             }
Ashish Agrawal
  • 1,977
  • 2
  • 18
  • 32
  • I already have the contact Id and the lookup key from the contacts.content_uri, im using it to find raw contact incase the id was changed – androiduae Sep 16 '15 at 20:06