I getting contact list by
permission
android:name="android.permission.READ_CONTACTS"
Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
startActivityForResult(intent, PICK_CONTACT);
but how to get Email address from
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();
}
}
but the problem is that i am not getting Email address from selected contact list so can any one give me solution
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…