Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: How to pick multiple contacts

Tags:

android

I'm using this code to let the user choose a contact:

Intent contactPickerIntent = new Intent(Intent.ACTION_PICK, Phone.CONTENT_URI);  
startActivityForResult(contactPickerIntent, 1001); 

but what I want to do is to let hime choose multiple contacts (with checkboxes). How can I do this ?

like image 217
Belgi Avatar asked Oct 21 '11 23:10

Belgi


People also ask

How do you select multiple contacts?

Multiple contacts: Touch and hold a contact and then tap the other contacts.

How do I select a contact list on Android contacts?

Contact someone On your Android phone or tablet, open the Contacts app . Tap a Contact in the list. Select an Option.

Which key do you use to select multiple contacts on?

Multi select contacts using shift key (like you can in gmail or excel) without having indiv select.

How do I get rid of duplicate contacts on my Android phone?

On your Android phone or tablet, open the Contacts app . At the top right, select the Google Account that has the duplicate contacts you want to merge. At the bottom, tap Fix & manage Merge & fix. Tap Merge duplicates.


1 Answers

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.

UPDATE:

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.

The API for the ContactsContract class is here as well.

like image 115
John Leehey Avatar answered Oct 10 '22 11:10

John Leehey