I tried to find the information here or online but I could not.
Could you please let me know if it is possible with java (android) to select only the checkbox checked without using the ID to identify it.
Imagine I have 100 hundred checkbox I can not do that for every checkbox :
CheckBox name0 = (CheckBox) findViewById(R.id.name0);
CheckBox name1 = (CheckBox) findViewById(R.id.name1);
CheckBox name2 = (CheckBox) findViewById(R.id.name2);
I want to only identify the one checked in order to put the value on a String variable. And once I can identify it I also want to extract its ID value and put it on a variable.
The ID come from XML :
<CheckBox
android:id="@+id/checkbox4Question1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:buttonTint="#F7D763"
android:text="Vade retro"
android:textColor="#FFFFFF"
android:onClick="answer"/>
Thank you for your help.
Aucun commentaire:
Enregistrer un commentaire