Skip to content Skip to sidebar Skip to footer

Assigning All Check Items Into A Variable

Is it possible to assign all the values from checked items in a single variable ? If radio button have this code .getCheckedRadioButtonId(), what about the checkboxes. Here's my xm

Solution 1:

Well, i think you could do an array of booleans which hold the answers.

Could look like this :

boolean[] checkboxAnswers = newboolean[3];
checkboxAnswers[0] = checkbox1.getChecked();
checkboxAnswers[1] = checkbox2.getChecked();
checkboxAnswers[2] = checkbox3.getChecked();

Post a Comment for "Assigning All Check Items Into A Variable"