diff --git a/multicontactpicker/src/main/java/com/wafflecopter/multicontactpicker/RxContacts/ColumnMapper.java b/multicontactpicker/src/main/java/com/wafflecopter/multicontactpicker/RxContacts/ColumnMapper.java index 95759c0..e8a5727 100644 --- a/multicontactpicker/src/main/java/com/wafflecopter/multicontactpicker/RxContacts/ColumnMapper.java +++ b/multicontactpicker/src/main/java/com/wafflecopter/multicontactpicker/RxContacts/ColumnMapper.java @@ -44,10 +44,10 @@ static void mapEmail (Cursor cursor, Contact contact, int columnIndex) { } } - static void mapPhoneNumber (Context con, Cursor cursor, Contact contact, int noColumnIndex, int typeColIndex) { + static void mapPhoneNumber (Context con, Cursor cursor, Contact contact, int noColumnIndex, int typeColIndex, int labelColIndex) { String phoneNumber = cursor.getString(noColumnIndex); int phonetype = cursor.getInt(typeColIndex); - String customLabel = cursor.getString(typeColIndex); + String customLabel = cursor.getString(labelColIndex); String phoneLabel = (String) ContactsContract.CommonDataKinds.Phone.getTypeLabel(con.getResources(), phonetype, customLabel); if (phoneNumber != null && !phoneNumber.isEmpty()) { // Remove all whitespaces diff --git a/multicontactpicker/src/main/java/com/wafflecopter/multicontactpicker/RxContacts/RxContacts.java b/multicontactpicker/src/main/java/com/wafflecopter/multicontactpicker/RxContacts/RxContacts.java index 2f09888..f06450d 100644 --- a/multicontactpicker/src/main/java/com/wafflecopter/multicontactpicker/RxContacts/RxContacts.java +++ b/multicontactpicker/src/main/java/com/wafflecopter/multicontactpicker/RxContacts/RxContacts.java @@ -58,7 +58,8 @@ public class RxContacts { private static final String[] NUMBER_PROJECTION = { ContactsContract.CommonDataKinds.Phone.CONTACT_ID, ContactsContract.CommonDataKinds.Phone.NUMBER, - ContactsContract.CommonDataKinds.Phone.TYPE + ContactsContract.CommonDataKinds.Phone.TYPE, + ContactsContract.CommonDataKinds.Phone.LABEL }; @@ -158,8 +159,9 @@ private void getPhoneNumber(long id, Cursor cursor, Contact contact, int hasPhon phoneCursor.moveToFirst(); int phoneNumberColumnIndex = phoneCursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER); int phoneNumberTypeIndex = phoneCursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.TYPE); + int labelColIndex = phoneCursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.LABEL); while (!phoneCursor.isAfterLast()) { - ColumnMapper.mapPhoneNumber(mContext, phoneCursor, contact, phoneNumberColumnIndex, phoneNumberTypeIndex); + ColumnMapper.mapPhoneNumber(mContext, phoneCursor, contact, phoneNumberColumnIndex, phoneNumberTypeIndex, labelColIndex); phoneCursor.moveToNext(); } phoneCursor.close();