I want to fetch the type of email type
and phone number type's
label used but when im fetching the data using these code its giving position of label use means return integer
value but i want the label used.
Where i am wrong in my code?
Success full getting email id but for type giving int
. value as 1,2.
So how to get label for type?
public String [] getEmailid(long _id) {
String emailid = null ;
String emailType = null ;
try {
Cursor cursor = getContentResolver().query(
ContactsContract.CommonDataKinds.Email.CONTENT_URI,
new String[]{Email.DATA,Email.TYPE},
ContactsContract.CommonDataKinds.Email.CONTACT_ID +" = "+ _id,
// We need to add more selection for phone type
null,
null);
if(cursor != null) {
while (cursor.moveToNext()) {
// This would allow you get several email addresses
// if the email addresses were stored in an array
// Log.i("RETURN EMAIL TYPA",emailid);
emailid = cursor.getString(cursor.getColumnIndex(Email.DATA));
emailType = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Email.TYPE));
// TODO Auto-generated method stub
if(emailid != null)
break;
}
}
}
//.....