views:

1369

answers:

1

How can I retrieve the positions of the selected item in a multichoice listView ? The getSelectedItemPosition method returns only the first one...

+3  A: 

There is at most one selected item in a ListView.

If your ListView is CHOICE_MODE_SINGLE or CHOICE_MODE_MULTIPLE, you can use getCheckedItemPositions() to get the checked ones.

CommonsWare
Tnahk you for your answer.the method returns a SparseBooleanArray. How can i use this object to find the positions ?
I have not used SparseBooleanArray. From the API, it appears you iterate over the size(), and for each index, you get the "key", which is a ListView position, and then get the value, which will be the boolean checked state of that position.
CommonsWare