How to get email and last name from contacts? - android

I have used an intent of contact picker. I am getting the data of contact through the intent. By that that intent I am fetching the name, number of the contact person.
When I tried to fetch an email id of contact it only shows the number of the contact instead of an email id. Also for last name of contact it shows always null though the last is been set to the contact.
Code:
private void contactPicked(Intent data) {
Cursor cursor = null;
try {
String phoneNo = null ;
String name = null;
// getData() method will have the Content Uri of the selected contact
Uri uri = data.getData();
//Query the content uri
cursor = getContentResolver().query(uri, null, null, null, null);
cursor.moveToFirst();
// column index of the phone number
int phoneIndex =cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER);
// column index of the contact name
int nameIndex =cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME);
int contactIdIndex =cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.CONTACT_ID);
int emailIndex = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA);
int lastNameIndex = cursor.getColumnIndex(ContactsContract.CommonDataKinds.StructuredName.FAMILY_NAME);
mOrganizerPhone = cursor.getString(phoneIndex);
mOraganizerName = cursor.getString(nameIndex);
mOrganizersId = cursor.getString(contactIdIndex);
mOrganizersEmail = cursor.getString(emailIndex);
mOrganizersLastName = cursor.getString(lastNameIndex);
Toast.makeText(PlanEventActivity.this,name+" "+phoneNo,Toast.LENGTH_SHORT).show();
} catch (Exception e) {
e.printStackTrace();
}
}
Thank you..

With "id", you can get the email address like this, this is an example:
public class CustomerForm extends Activity {
private final static int CONTACT_PICKER = 1;
private EditText txtMailContacto;
private EditText txtNombreContacto;
private EditText txtTelefono;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_customer_form);
txtMailContacto = (EditText) findViewById(R.id.txtMailContacto);
txtTelefono = (EditText) findViewById(R.id.txtTelefono);
txtNombreContacto = (EditText) findViewById(R.id.txtNombreContacto);
}
public void pickContact(View v)
{
Intent contactPickerIntent =
new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
startActivityForResult(contactPickerIntent, CONTACT_PICKER);
}
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// check whether the result is ok
if (resultCode == RESULT_OK) {
// Check for the request code, we might be using multiple startActivityForReslut
switch (requestCode) {
case CONTACT_PICKER:
contactPicked(data);
break;
}
} else {
Log.e("MainActivity", "Failed to pick contact");
}
}
private void contactPicked(Intent data) {
ContentResolver cr = getContentResolver();
Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);
cur.moveToFirst();
try {
// getData() method will have the Content Uri of the selected contact
Uri uri = data.getData();
//Query the content uri
cur = getContentResolver().query(uri, null, null, null, null);
cur.moveToFirst();
// column index of the contact ID
String id = cur.getString(cur.getColumnIndex(ContactsContract.Contacts._ID));
// column index of the contact name
String name = cur.getString(cur.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
txtNombreContacto.setText(name); //print data
// column index of the phone number
Cursor pCur = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,null,
ContactsContract.CommonDataKinds.Phone.CONTACT_ID +" = ?",
new String[]{id}, null);
while (pCur.moveToNext()) {
String phone = pCur.getString(
pCur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
txtTelefono.setText(phone); //print data
}
pCur.close();
// column index of the email
Cursor emailCur = cr.query(
ContactsContract.CommonDataKinds.Email.CONTENT_URI,
null,
ContactsContract.CommonDataKinds.Email.CONTACT_ID + " = ?",
new String[]{id}, null);
while (emailCur.moveToNext()) {
// This would allow you get several email addresses
// if the email addresses were stored in an array
String email = emailCur.getString(
emailCur.getColumnIndex(ContactsContract.CommonDataKinds.Email.ADDRESS));
txtMailContacto.setText(email); //print data
}
emailCur.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}

Related

Get the email address from a contact

I'm trying to get the Email address of a user I select in the contact list. I am able to get the ID, phone and name of the contact and by using the ID, I am trying to get the Email address using a new Cursor but am unable to get the details from the contact.
Below is the code I am using:
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent aData) {
super.onActivityResult(requestCode, resultCode, aData);
if (requestCode == PICK_CONTACT && resultCode == Activity.RESULT_OK && aData != null) {
ContentResolver cr = getContentResolver();
String phoneNo = "";
String name = "";
String id = "";
String email = "";
Uri uri = aData.getData();
if (uri != null) {
Cursor cursor = cr.query(uri, null, null, null, null);
if (cursor != null) {
if (cursor.moveToFirst()) {
id = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts._ID));
int phoneIndex = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER);
int nameIndex = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME);
phoneNo = cursor.getString(phoneIndex);
name = cursor.getString(nameIndex);
}
cursor.close();
} else {
showDialog(getString(R.string.lbl_error_message_contact));
}
} else {
showDialog(getString(R.string.lbl_error_message_contact));
}
Cursor emailCur = cr.query(
ContactsContract.CommonDataKinds.Email.CONTENT_URI,
null,
ContactsContract.CommonDataKinds.Email.CONTACT_ID + " = ?",
new String[]{id}, null);
while (emailCur.moveToNext()) { // when it gets here, it just skips the while loop and jumps down to the to close the emailCur
// This would allow you get several email addresses
// if the email addresses were stored in an array
email = emailCur.getString(
emailCur.getColumnIndex(ContactsContract.CommonDataKinds.Email.ADDRESS));
}
emailCur.close();
mMedia.setLendersName(name);
mMedia.setPhoneNumber(phoneNo);
mMedia.setEmail(email);
}
}
Could it be that the ID may not be correct?
EDIT
One thing that is really weird is that when I select a contact and return back to the screen. The ID is very different to the ID I get when I run #Android Team's code which returns all the contacts with email addresses. What could be the reason behind this?
My thinking when I was trying to get the email address was that the ID's wont be different, but it seems it is the case.
when you getting device contact information you can add permission in manifest file..
<uses-permission android:name="android.permission.READ_CONTACTS"/>
then after used below method to get all the email id which device store in contact..
/**
* this method read device in contact name and email.
*/
public void getContact() {
Cursor cur = getActivity().getContentResolver().query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);
if (cur.getCount() > 0) {
while (cur.moveToNext()) {
String id = cur.getString(cur.getColumnIndex(ContactsContract.Contacts._ID));
Cursor cur1 = getActivity().getContentResolver().query(
ContactsContract.CommonDataKinds.Email.CONTENT_URI, null,
ContactsContract.CommonDataKinds.Email.CONTACT_ID + " = ?",
new String[]{id}, null);
while (cur1.moveToNext()) {
//to get the contact names
String name = cur1.getString(cur1.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME));
Log.e("Name :", name);
String email = cur1.getString(cur1.getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA));
Log.e("Email", email);
}
cur1.close();
}
}
}
check in log cat show all email id to be added in device.
I hope you know the Permission part and all, just add this code once you are allowed permission by user, and populate the email string in Edittext use it wherever you want
Account[] accounts = AccountManager.get(activityContext).getAccountsByType("com.google");
for (Account account : accounts) {
// if (emailPattern.matcher(account.name).matches()) {
String possibleEmail = account.name;
}
You might have to use this piece of code in activity to Populate the data, just an Add On
runOnUiThread(new Runnable() {
public void run() {
regEmail.setText(emailId);
}
});
I don't think some of you understood what I was trying to say, but this is the solution I found to get the Contact details of a selected contact by starting an intent to get the details from the Systems contact list.
Start the intent with the following intent to get the Name and Phone number:
Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.CommonDataKinds.Phone.CONTENT_URI);
startActivityForResult(intent, PICK_CONTACT);
Once the contact is selected, it comes back into onActivityResult. Here is an example of getting the Name and Phone number from the response.
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent aData) {
super.onActivityResult(requestCode, resultCode, aData);
if (requestCode == PICK_CONTACT && resultCode == Activity.RESULT_OK && aData != null) {
final String[] projection = new String[]{ContactsContract.CommonDataKinds.Email.DATA, ContactsContract.CommonDataKinds.Email.TYPE};
ContentResolver cr = getContentResolver();
String phoneNo;
String name;
String lookUpKey = "";
String email;
Uri uri = aData.getData();
if (uri != null) {
// ****************************First we want to get the Lookup Key, Name and Phone number****************************
Cursor cursor = cr.query(uri, null, null, null, null);
if (cursor != null) {
if (cursor.moveToFirst()) {
lookUpKey = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.LOOKUP_KEY));
int phoneIndex = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER);
int nameIndex = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME);
phoneNo = cursor.getString(phoneIndex);
name = cursor.getString(nameIndex);
mMedia.setLendersName(name);
mMedia.setPhoneNumber(phoneNo);
}
// ****************************Now we want to get the email address, if any from the contact****************************
// At this point, we use the Lookup key of the contact above, to get the email address (If any)
if (!TextUtils.isEmpty(lookUpKey)) {
//Do a query with the Lookup key to get the email details (Could possibly get more data as well, but I just needed the email address
cursor = cr.query(ContactsContract.CommonDataKinds.Email.CONTENT_URI, projection, ContactsContract.Data.LOOKUP_KEY + "=?", new String[]{lookUpKey}, null);
if (cursor != null) {
while (cursor.moveToNext()) {
// Get the index of the column for the email address here
final int contactEmailColumnIndex = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA);
while (!cursor.isAfterLast()) {
// Here is where we get the email address itself
email = cursor.getString(contactEmailColumnIndex);
// Set it where ever you need it.
mMedia.setEmail(email);
cursor.moveToNext();
}
}
// Dont forget to close the cursor once you done with it
cursor.close();
}
}
} else {
showDialog(getString(R.string.lbl_error_message_contact));
}
} else {
showDialog(getString(R.string.lbl_error_message_contact));
}
}
}

get contact and email id from users phonebook

I want to get contact and email id from users phonebook and i want to populate them in textfields.
My code is..
Uri uri = Uri.parse("content://contacts");
Intent intent = new Intent(Intent.ACTION_PICK, uri);
intent.setType(ContactsContract.CommonDataKinds.Phone.CONTENT_TYPE);
Log.i("please","work");
startActivityForResult(intent, REQUEST_CODE);
and onActivityResult() method
#Override
protected void onActivityResult(int requestCode, int resultCode,
Intent intent) {
if (requestCode == REQUEST_CODE) {
if (resultCode == RESULT_OK) {
Uri uri = intent.getData();
String[] projection = { Phone.NUMBER, Phone.DISPLAY_NAME };
Cursor cursor = getContentResolver().query(uri, projection,
null, null, null);
cursor.moveToFirst();
int numberColumnIndex = cursor.getColumnIndex(Phone.NUMBER);
String number = cursor.getString(numberColumnIndex);
int nameColumnIndex = cursor.getColumnIndex(Phone.DISPLAY_NAME);
String name = cursor.getString(nameColumnIndex);
Log.d(TAG, "ZZZ number : " + number +" , name : "+name);
}
}
};
but this is not calling the onActivityResult function.
please help me with the issue?
get contact list like
private void insertDummyContact() {
Cursor phones = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, null, null, null);
while (phones.moveToNext()) {
String name = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME));
String phoneNumber = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
AppController.MyApplication.getInstance().trackScreenView("Contact List Invite");
Name.add(name);
Number.add(phoneNumber);
}
phones.close();
// Log.e("number", Name.toString());
// Log.e("name", Number.toString());
ListAdapter = new ContactListAdapter(ContactListInvite.this, Name, Number);
ContactList.setAdapter(ListAdapter);
ListAdapter.notifyDataSetChanged();
}

Android, cannot retrieve phone numbers using user id

I'm trying to retrieve the phone number of a user after selecting him in a picker activity.
This is the code to start the Activity:
Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.CommonDataKinds.Phone.CONTENT_URI);
startActivityForResult(intent, Constants.COMMUNICATION_CONFIG_RESULT);
This is the code to retrive user name, id and phone number, it's used in a onActivityResult:
Uri contactData = data.getData();
ContentResolver cr = getContentResolver();
Cursor cursor = cr.query(contactData, null, null, null, null);
if (cursor.moveToFirst()) {
String contactId =
cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone._ID));
String name = cursor.getString(
cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
String hasPhone =
cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER));
if (hasPhone.equalsIgnoreCase("1")) {
Cursor phones = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,null,
ContactsContract.CommonDataKinds.Phone.CONTACT_ID +" = "+ contactId,null, null);
phones.moveToFirst();
String contactNumber = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
Log.i("phoneNUmber", "The phone number is "+ contactNumber);
}
}
I get always the user name and id, and the user has always the phone number, but the cursor phone is always empty, regardless of the user selected.
Why can't I get the phone numbers?
Found out the problem. It must be:
String contactId = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.CONTACT_ID));
if then I query the phone number via
Cursor phones = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,null,
ContactsContract.CommonDataKinds.Phone.CONTACT_ID +" = "+ contactId,null, null);
The problem was that I selected different fields for the query.
// try this way,hope this will help you...
Intent i = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
startActivityForResult(i, 1);
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK) {
String phoneNumber = getPhoneNumber(data.getData());
if (phoneNumber.trim().length() > 0) {
// use this phoneNumber
} else {
ting("Phone Number Not Founded ...");
}
}
}
private String getPhoneNumber(Uri contactInfo) {
String phoneNumbers = "";
Cursor cursor = getContentResolver().query(contactInfo, null, null, null, null);
while (cursor.moveToNext()) {
String contactId = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts._ID));
String hashPhone = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER));
if ("1".equalsIgnoreCase(hashPhone)) {
Cursor contactCursor = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = " + contactId, null, null);
while (contactCursor.moveToNext()) {
int type = contactCursor.getInt(contactCursor.getColumnIndex(Phone.TYPE));
if (type == Phone.TYPE_MOBILE) {
int colIdx = contactCursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER);
phoneNumbers = phoneNumbers.concat(contactCursor.getString(colIdx));
break;
}
}
contactCursor.close();
}
}
cursor.close();
return phoneNumbers;
}

get Email Address from contact list

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
You can use following code to retrieve email.
public ArrayList<String> ShowContact() {
nameList = new ArrayList<String>();
phoneList = new ArrayList<String>();
emailList = new ArrayList<String>();
ContentResolver cr = getContentResolver();
Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null,
null, null, null);
if (cur.getCount() > 0) {
while (cur.moveToNext()) {
String id = cur.getString(cur
.getColumnIndex(ContactsContract.Contacts._ID));
String name = cur
.getString(cur
.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
if (Integer
.parseInt(cur.getString(cur
.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER))) > 0) {
// Query phone here. Covered next
Cursor pCur = cr.query(
ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
null,
ContactsContract.CommonDataKinds.Phone.CONTACT_ID
+ " = ?", new String[] { id }, null);
while (pCur.moveToNext()) {
// Do something with phones
String phoneNo = pCur
.getString(pCur
.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
nameList.add(name); // Here you can list of contact.
phoneList.add(phoneNo); // Here you will get list of phone number.
Cursor emailCur = cr.query(
ContactsContract.CommonDataKinds.Email.CONTENT_URI,
null,
ContactsContract.CommonDataKinds.Email.CONTACT_ID + " = ?",
new String[]{id}, null);
while (emailCur.moveToNext()) {
String email = emailCur.getString(emailCur.getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA));
emailList.add(email); // Here you will get list of email
}
emailCur.close();
}
pCur.close();
}
}
}
return nameList; // here you can return whatever you want.
}
function for fetch email id of selected contact
private void retrieveContactEmail()
{
Cursor cursorID = getContentResolver().query(uriContact,
new String[]{ContactsContract.Contacts._ID},
null, null, null);
if (cursorID.moveToFirst()) {
contactID = cursorID.getString(
cursorID.getColumnIndex(ContactsContract.Contacts._ID));
}
Cursor cursor = getContentResolver().query(
ContactsContract.CommonDataKinds.Email.CONTENT_URI, null,
ContactsContract.CommonDataKinds.Email.CONTACT_ID + "=?",
new String[]{contactID}, null);
int emailIdx = cursor.getColumnIndex(
ContactsContract.CommonDataKinds.Email.DATA);
if (cursor.moveToFirst()) {
String emailg = cursor.getString(emailIdx);
if(emailg!=null) {
email.setText(emailg);
}
else {
Toast.makeText(Activity.this,
"No email id for this contact",
Toast.LENGTH_LONG
).show();
}
}
}
use
String emailAdd = cursorEmail.getString(cursorEmail.getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA));
instead of
String emailAdd = cursorEmail.getString(cursorEmail.getColumnIndex(ContactsContract.CommonDataKinds.Email.ADDRESS));

GetAndroid contact information (phone, name, etc...)

I know you might think this subject has been treated several times but this is different!
My app is supposed to get contact information (name, number) from a picked contact but I only get the name and I can't get the number.
#Override
public void onClick(View v) {
// Opening Contacts Window as a Window
Intent contactPickerIntent = new Intent(Intent.ACTION_PICK,
ContactsContract.Contacts.CONTENT_URI);
// calling OnActivityResult with intent And Some contact for Identifie
startActivityForResult(contactPickerIntent, PICK);
}
#Override
public void onActivityResult(int reqCode, int resultCode, Intent data) {
super.onActivityResult(reqCode, resultCode, data);
switch (reqCode) {
case (PICK) :
if (resultCode == Activity.RESULT_OK) {
Uri contactData = data.getData();
Cursor c = managedQuery(contactData, null, null, null, null);
if (c.moveToFirst()) {
int indexName = c.getColumnIndex(
ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME);
int indexNumber = c.getColumnIndex(
ContactsContract.CommonDataKinds.Phone.NUMBER);
nom = c.getString(indexName);
numero = c.getString(indexNumber);
//Visual confirm
Toast.makeText(this, "Contact " + nom +" enregistré!",
Toast.LENGTH_LONG).show();
//Save in prefs:
SharedPreferences manager =
PreferenceManager.getDefaultSharedPreferences(this);
Editor editor = manager.edit();
editor.putString("num", numero);
editor.putString("nom", nom);
editor.commit();
The name is correct but the number causes a force close.
But if I replace it with the following there is no longer a force close, but the number is still incorrect (0 or 1).
int indexNumber = c.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)+1;
What should I do?
private void getDetails(){
Uri uri = ContactsContract.CommonDataKinds.Phone.CONTENT_URI;
ContentResolver cr = getContentResolver();
Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI,null, null, null, null);
String[] projection = new String[] {ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME,
ContactsContract.CommonDataKinds.Phone.NUMBER };
Cursor names = getContentResolver().query(uri, projection, null, null, null);
int indexName = names.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME);
int indexNumber = names.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER);
names.moveToFirst();
do {
String name = names.getString(indexName);
Log.e("Name new:", name);
String number = names.getString(indexNumber);
Log.e("Number new:","::"+number);
} while (names.moveToNext());
}
The above retrun all the name and number from from your contact database..
if you even need email id you add these lines also:::
while (cur.moveToNext()) {
String id = cur.getString(cur.getColumnIndex(ContactsContract.Contacts._ID));
Cursor email = cr.query(
ContactsContract.CommonDataKinds.Email.CONTENT_URI, null,
ContactsContract.CommonDataKinds.Email.CONTACT_ID + " = ?",
new String[]{id}, null);
while (email.moveToNext()) {
//to get the contact names
// if the email addresses were stored in an array
String emailid = email.getString(email.getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA));
Log.e("Email id ::", emailid);
String emailType = email.getString(email.getColumnIndex(ContactsContract.CommonDataKinds.Email.TYPE));
Log.e("Email Type ::", emailType);
}
email.close();
}

Categories

Resources