Multiple-Choice List Check Events
Not that long ago, I answered a question on android-developers
regarding the use of a CHOICE_MODE_MULTIPLE
ListView
. One
of the parts of the question was how to find out when a
list item’s checked state is toggled. Seeing nothing in the
API, I guessed that there was no way to find that out.
Ich bin ein moron.
I forgot that, on a multiple-choice ListView
, you’re not just
tapping on the checkbox – the whole list item is clickable,
toggling the checkbox state. Hence, you find out about checked
state changes using the standard on-item-click mechanisms
(e.g., onListItemClick()
in a ListActivity
).
I’ll be uploading some sample code for this soonish, in the form of a Java port of the HTML5 “Checklist” application from my in-progress Android Beyond Java book.