dimanche 3 janvier 2016

How can I get the selected value of the checked checkboxes written programmatically in android?

I have a checkbox written programmatically in android, it is programmatically written because the value of the checkbox will be based on online content, so basically, the program has no idea on how many checkbox will going to print. I use for loops to print checkboxes, and it was successful, but among those checkboxes, I want to get the value of the checkboxes that will going to be selected. How can I do that?

String ans = _jsonObject.optString("choices").toString();
                String[] ansar = ans.split("`");
                cb = new CheckBox[ansar.length];
                for (int z = 0; z<ansar.length; z++){
                    CheckBox cb = new CheckBox(survey);
                    cb.setText(ansar[z]);
                    choiceslayouts.addView(cb);
                }




Aucun commentaire:

Enregistrer un commentaire