In my programm I have a simple ListView
and set an ArrayAdapter
on it:
arrayAdapter = new ArrayAdapter<String>(getApplicationContext(),
R.layout.row_layout_checkbox, R.id.textView_checkbox, list);
listView.setAdapter(arrayAdapter);
"list" is a String-Array(String[]).
Layout XML row_layout_checkbox :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="60dp"
android:orientation="vertical">
<CheckBox
android:id="@+id/checkBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginRight="14dp"
android:layout_marginEnd="14dp"/>
<TextView
android:id="@+id/textView_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginLeft="17dp"
android:layout_marginStart="17dp"
android:text="TextView"
android:textColor="@color/colorBlack"/>
</RelativeLayout>
So my question: How can I check which checkboxes are checked or not so I can put true or false in an boolean-Array?
(It should can check the checkboxes of each item and should be multiple choice not single choice.)
Aucun commentaire:
Enregistrer un commentaire