Count checkboxes marked within a TableLayout

0

I have a list of checkboxes and I want to know how many of them are checked before continuing with the flow of the application. Each of the checkboxes is in a TableRow within a TableLayout. The list of checkboxes is written manually, they do not come from an Adapter. Is there any way to get that count without using an Adapter? Or should I create my table dynamically?

<TableLayout
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:id="@+id/questions_table"
   >
   <TableRow
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       android:paddingBottom="10dp"
       android:shrinkColumns="0"
       android:stretchColumns="0">
       <TextView
           android:text="Question #1"
           android:layout_width="match_parent"
           android:layout_height="wrap_content"
           android:layout_gravity="center_vertical"
           android:layout_marginStart="15dp"
           android:layout_marginEnd="15dp"
           android:layout_weight="1"
           />
       <CheckBox
    android:id="@+id/cb_01"
           android:checked="true"
           android:layout_width="wrap_content"
           />
   </TableRow>

                                  

And so on to question 25, with checkbox cb_25

    
asked by Edgar 27.02.2017 в 18:51
source

0 answers