0

Hi boys and girls (of course)

How do I get the Uri of from mail contact? And from there I get the rest of the information from this( I already have this implemented) I saw an example in Android - Get Contact Photo from phone number to do it with the number and get the photo, but I do not know what to do to do it from the email

Regars

San Juan
  • 107
  • 1
  • 10

1 Answers1

0

This is what I did

Cursor cursor= activity.getContentResolver().query(ContactsContract.Data.CONTENT_URI, null,ContactsContract.Data.DATA1 + " = '"+mail+"' ", null,null);
String contID = null;
if (cursor !=null && cursor.moveToFirst()){
    contID = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Email.RAW_CONTACT_ID));
    cursor.close();
}

After that you have the contactID, and whit that you can do another query to get all the data

San Juan
  • 107
  • 1
  • 10