Android: How to pick multiple contacts

前端 未结 1 366
我在风中等你
我在风中等你 2021-01-04 22:59

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

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


        
相关标签:
1条回答
  • 2021-01-04 23:26

    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.

    0 讨论(0)
提交回复
热议问题