Contact picker that shows number, contact name and

2019-05-31 04:02发布

问题:

Is there any way to display contact picker that has both number and contact name?

Now I'm calling picker:

startActivityForResult(
                       new Intent(Intent.ACTION_PICK,Contacts.Phones.CONTENT_URI),
                       1);

But in a result I get only Contact names without visible numbers. To make things worse, if one contact has two numbers it occurs twice.

回答1:

try this. its just like the contact picker, but lists clickable phone numbers under the contacts name

Intent intent = new Intent(Intent.ACTION_PICK, Contacts.CONTENT_URI);
intent.setType(ContactsContract.CommonDataKinds.Phone.CONTENT_TYPE);
startActivityForResult(intent, 1);


回答2:

You can check out the free Android contact picker library at https://github.com/codinguser/android_contact_picker which allows a user to

  • pick a contact from a list of contacts,
  • display the details and
  • then select a number (and then you can do what you want with the number)

Disclosure: I am the author of this library



回答3:

I had the similar problem and could not find any way to display the required information together.

Finally I created a ListView and display the Contact along with the Number information. You can refer to this tutorial to build one easily - http://www.droidnova.com/first-list-application,37.html