Answers for "loop through a radio group to get an array of all radio buttons in android java"

0

android iterate through radio group java

int count = radioGroup.getChildCount();
ArrayList<RadioButton> listOfRadioButtons = new ArrayList<RadioButton>();
for (int i=0;i<count;i++) {
  View o = radioGroup.getChildAt(i);
  if (o instanceof RadioButton) {
    listOfRadioButtons.add((RadioButton)o);
  }
}
Log.d(TAG,"you have "+listOfRadioButtons.size()+" radio buttons");
Posted by: Guest on October-07-2020

Code answers related to "loop through a radio group to get an array of all radio buttons in android java"

Browse Popular Code Answers by Language