Android-ContactPicker icon indicating copy to clipboard operation
Android-ContactPicker copied to clipboard

How to display contact number only in textview

Open son2017 opened this issue 7 years ago • 1 comments

i am able to display name but i cant able to send message with selected name is there any way to show only number instead of name.

son2017 avatar Nov 23 '17 06:11 son2017

I fixed it to display phone numbers in edit Text. Go to the activity where you are sending messages and locate the populateContact method: Then modify as follows:

private void populateContact(SpannableStringBuilder result, ContactElement element, String prefix) { long tphoneid=element.getId(); String phone = null; String tphoneid2=Long.toString(tphoneid); ContentResolver cr = getContentResolver(); Cursor cp = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = ?", new String[]{tphoneid2}, null); if (cp != null && cp.moveToFirst()) { phone = cp.getString(cp.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)); cp.close(); }

    String displayName=phone;
    displayName.replaceAll("\\s","");
    result.append(prefix);

    result.append(displayName + ",");

    //result.setSpan(new BulletSpan(15), start, result.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
}

C-Spydo avatar Jun 27 '18 07:06 C-Spydo