Possible Duplicate:
Android: Binding data from a database to a CheckBox in a ListView?
i want to use a ListView with the items having following layout
------------------------- [CB] TV TV ------------------------- CB is a checkbox and TV is a Textview.
Now i've read somewhere that you can't have clickable items in a ListView. If you have some then you won't be able to click on the ListItems. But if I look at the GoogleMail app, this is possible. I can mark several messages with the checkbox (and then select an action for them) or i can click on the ListItem (or scroll with the dpad) to get to another screen. Does someone has code/example how this is possible?
Set the CheckBox as focusable="false" in your XML layout. Otherwise it will steal click events from the list view.
Of course, if you do this, you need to manually handle marking the CheckBox as checked/unchecked if the list item is clicked instead of the CheckBox, but you probably want that anyway.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With