0

My code:

Intent intent = new Intent();
intent.setAction(Intent.ACTION_PICK);
intent.setData(ContactsContract.Contacts.CONTENT_URI);
startActivityForResult(intent, REQUEST_CONTACT);

This will open the system contacts but I just can pick one contact. I want to open it in such a way that I can pick as many as items I want and return.

Thanks!

Stefan
  • 17,448
  • 11
  • 60
  • 79
JulyChobits
  • 31
  • 1
  • 1
  • 2

2 Answers2

0

You won't be able to do it so with the ACTION_PICK intent option.Here is the solution for the query: https://stackoverflow.com/a/7856444840/14765699

Community
  • 1
  • 1
vinay
  • 90
  • 7
0

You won't be able to do it with the ACTION_PICK intent option. To implement this, you'll need to use a custom ListView with contacts generated from a query to the contacts content provider.

If you want to use the Intent.ACTION_PICK intent, you'll need to tell the user to pick one-at-a-time.

Also

There are several ways to do this with a custom ListView. The old way (that is compatible with most phones) is a bit lengthy to explain, but luckily there is a good tutorial here describing exactly what you're looking for (contact list with checkbox in a custom ListView).

With API 5 and above, there is a ContactsContract class that can help with getting a list of contacts. For example code on how to use this, look at android's ContactManager sample application, specifically the ContactManager class and the populateContactList() method.

Hope it will be helpfull

Sarav
  • 17
  • 2
  • 11