How to get to know whether the checkbox is checked or not in a multiple choice listview in android?
-
13-11-2019 - |
Question
I am using multiple choice listview,in this I would am getting the position values when clicked on it.how to know whether it is checked or not.Kindly help me on this.Thanks.
Solution
set:
listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
and check if a particular view from the listView is checked with:
listView.isItemChecked(i) //i is the position of the view.
OTHER TIPS
Use Array boolean[] selected
, where you save checkboxes state.
In your OnItemSelected method use this:
selected[position] = true or false
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow