0

i need to know how list the contacts of phonebook in a check box list to select more than 1 contact at the same time, because i need it to take the checked phone numbers and send to a multi-contact list sms message

dakairus
  • 43
  • 1
  • 7
  • 1
    This isn't a code writing service. Please try to do some research (a search for 'android check box list' shows many promising examples), read some tutorials, and then try to ask again if you have a specific question. – Tim Apr 30 '12 at 18:15
  • check this tutorial http://www.quicktips.in/how-to-create-multi-select-listview-android-with-custom-adapter/ – Deepak Swami Aug 25 '15 at 03:36

2 Answers2

2

This is a very broad/long question. I've done this for one of my applications, so I can outline the steps for you and give you pointers.

Getting the Phone Numbers

You'll need to interact with the Contacts API. More specifically, ContactsContract. http://dev.schmid.pro/android/get-contacts-on-android-2-0

How to read contacts on Android 2.0

It's probably best to put the data in an ArrayList.

Displaying

You can use a multi-select listview, which is fairly easy to implement

Or

If you are set on creating a listview with checkboxes, you'll have to create a custom adapter so that you can control the clicking of the checkbox, textview, entire row, etc. http://windrealm.org/tutorials/android/listview-with-checkboxes-without-listactivity.php

Custom adapters are more complex than using the ListView, however, they are powerful and useful and I'd suggest learning them anyways.

Community
  • 1
  • 1
Gophermofur
  • 2,101
  • 1
  • 14
  • 14
0

You don't need a check box list, but a List View with proper setting.

if you set the choiceMode to either multipleChoice or multipleChoiceModal (3.0+) it automatically render the lists items with a check box on right. User getCheckedItemPositions() to access the checked items.

xandy
  • 27,357
  • 8
  • 59
  • 64