0
I have a listview with check box
I’m looking to put a checkbox on top of the list. So when I select it, I want to select everything from the list and when I click to take the selection I want to take the selection from the whole list.
How to do this?
This is the XML I created to be the layout of each item in the list
<CheckBox
android:id="@+id/checkBox1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:focusable="false"
android:focusableInTouchMode="false"
android:text="CheckBox" />
<TextView
android:id="@+id/code"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/checkBox1"
android:layout_alignBottom="@+id/checkBox1"
android:layout_toRightOf="@+id/checkBox1"
android:text="TextView" />
Here I select the Adapter, the list passed as parameter has the name and number of the recipient.
dataAdapter = new MyCustomAdapter(this,R.layout.item_list_info, lista);
ListView listView = (ListView) findViewById(R.id.lista);
listView.setAdapter(dataAdapter);