android iterate through radio group java

Solutions on MaxInterview for android iterate through radio group java by the best coders in the world

showing results for - "android iterate through radio group java"
Jerónimo
19 Oct 2018
1int count = radioGroup.getChildCount();
2ArrayList<RadioButton> listOfRadioButtons = new ArrayList<RadioButton>();
3for (int i=0;i<count;i++) {
4  View o = radioGroup.getChildAt(i);
5  if (o instanceof RadioButton) {
6    listOfRadioButtons.add((RadioButton)o);
7  }
8}
9Log.d(TAG,"you have "+listOfRadioButtons.size()+" radio buttons");