0

I have simple listview (Not custom listview) with checkbox in right side but these checkboxes are not clickable.

Here is my MainActivity.java Code:

setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_multiple_choice, getResources().getStringArray(R.array.myarray)));

and here is xml code:

 <ListView
        android:id="@android:id/list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
         >
    </ListView>

Also I need help to find out which checkbox was clicked on click of some button.

I have seen may questions posted on stackoverflow but they were all realeated to custom listview.

Kapil
  • 1,790
  • 1
  • 16
  • 32
  • Check [this](http://stackoverflow.com/questions/5417339/android-listview-with-checkbox-and-all-clickable) SO question, basically you'll need to set the checkbox focusable as false. – Ende Neu May 04 '13 at 20:34

1 Answers1

0
listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
listView.setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_checked, getResources().getStringArray(R.array.myarray)));
chRyNaN
  • 3,592
  • 5
  • 46
  • 74
  • Thanks for the help and now i am able to click on checkboxes but Can u help me in finding out what all checkboxes were checked(on click of a button). Please modify your above code. – Kapil May 05 '13 at 09:23