Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sample Project to select multiple contacts

I want my app to operate such that activity A starts activity B in an intent for result, where activity B is the list view where user selects multiple contacts. Then in activity A, I want to be able to extract the phone numbers in an ArrayList. There are many questions and answers around this issue on Stack Overflow. To list two:

  • using checkbox to filter contacts and get phone number

  • checkbox in listview for multiple selection of contacts

As one still relatively new to Android development, I find the dispersed code difficult to assemble. So my question: Does anyone have a simple project that does what I seek complete, that they don't mind sharing in a zip file? In the last response in using checkbox to filter contacts and get phone number the guy claims to have such a zip project, but when I follow the link, the secondary link that should lead to the project was broken.

If someone does agree to provide a link, please let it not be a partial answer. I figure the task is simple to someone who has done it before: It's two activities, where one is a ListView allowing users to select contacts and the other is a view that displays the selected contacts. In fact, the other does not even have to display the contacts in a view, a simple println to the LogCat will suffice.

like image 641
learner Avatar asked Apr 07 '13 16:04

learner


1 Answers

This might help you. It is not what you're exactly looking for but it will give you an idea to start working with. I've used Loaders to fetch contacts from phone directory and performing search operations on it. You can use the same Loader to populate a ListView containing TextView (name/number) and CheckBox pair as list item. You can maintain a HashMap of position vs contact number for keeping track of selected contacts. Hope this helps.

EDIT

The updated link is here.

like image 55
Purush Pawar Avatar answered Nov 06 '22 08:11

Purush Pawar