In my app I have a list with rows, each containing an image, text, and a checkbox. I overrode the getView method of my simpleadapter to include a tag for each checkbox based on its position in the row (code is here http://www.heypasteit.com/clip/YME … bs and bs1 are booleans). That way I could tell which checkbox was being changed when onCheckedChanged was invoked. However, I need to set the state of individual checkboxes manually. For example, set the state of the checkbox with tag “3” (the checkbox on row 3) to “true.”
Any help on this would be much appreciated!
You can replace your approach with an array of booleans. For example, if you have 15 elements in array, you can create a boolean[15], and change state of different positions when user clicks a checkbox, as well as set the initial state in the beginning.
Not a perfect example, but I hope you’ll get the idea:
}
Don’t forget to call yourAdapterInstance.notifyDataSetChanged() if you are trying to update checkboxes states from outside of checkedChangeListener and after initial onCreate() method;