Search code examples
androidandroid-widgetlistactivitylistadapter

onListItemClick method not called when I use Checkox in list


Hi guys I am new to android...I want to display a dynamic list of CheckBox and on Clicking multiple of those CheckBoxes i want their data in a single string...But my problem is that i am unable to call onListItemClick method if I use checkBox in my List...

It is my understanding and experience however that putting a focusable view in the list item prevents the firing of onListItemClick() in the ListActivity when the list item is clicked. But can anyone Plz give me solution...

I have referred links like

How to fire onListItemClick in Listactivity with buttons in list?

Android ListActivity onListItemClick calls adapter getView

but unable to find a solution...


Solution

  • To make it working you can set Checkboxes and other fields in the ListItem unclickable and unfocusable, by properties:

    android:clickable="false"
    android:focusable="false"