E-Mail-Adresse von der Kontaktliste abrufen

Ich bekomme eine Kontaktliste von

Genehmigung

android:name="android.permission.READ_CONTACTS"


Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
startActivityForResult(intent, PICK_CONTACT);

aber wie bekomme ich eine email adresse von

 public void onActivityResult(int reqCode, int resultCode, Intent data) {
//what should i have to write to fetch email address of selected contact
// I wrote like below but i could not get result

 if (resultCode == Activity.RESULT_OK) {  
     try{
             Uri contactData = data.getData();

             Cursor cursorEmail = getContentResolver().query(contactData,null,null,null,null);
             cursorEmail.moveToFirst();
             String emailAdd =  cursorEmail.getString(cursorEmail.getColumnIndex(ContactsContract.CommonDataKinds.Email.ADDRESS));
             Toast.makeText(MySettings.this, emailAdd, Toast.LENGTH_LONG).show();
          }catch(Exception e){
              Toast.makeText(MySettings.this, "No Email Add found", Toast.LENGTH_LONG).show();
          }

}

Aber das Problem ist, dass ich keine E-Mail-Adresse von der ausgewählten Kontaktliste bekomme, also kann mir irgendjemand eine Lösung geben

Antworten auf die Frage(3)

Ihre Antwort auf die Frage