How to get Phone number from Android Cursor?
Following this tutorial I'm trying to get the phone number of a person in
the contacts list. With this code I can get the email address:
if (cursor.moveToFirst()){
int emailIdx = cursor.getColumnIndex(Email.DATA);
String email = cursor.getString(emailIdx);
Log.wtf("Email address: ", email);
}
Following this reasoning I tried to get the Phone number like this:
if (cursor.moveToFirst()){
int phoneNrIdx = cursor.getColumnIndex(Phone.DATA);
String phoneNr = cursor.getString(phoneNrIdx);
Log.wtf("Phone number:", phoneNr);
}
Unfortunately this also returns the email address. Does anybody know how I
can get the phone number of this contact? All tips are welcome!
No comments:
Post a Comment