Get the array of RadioButtons in a RadioGroup in Android -
is there way of getting array (or collection) of radiobutton
s in android radiogroup
? add individual listeners radio buttons don't see obvious way of iterating on them.
this should trick:
int count = radiogroup.getchildcount(); arraylist<radiobutton> listofradiobuttons = new arraylist<radiobutton>(); (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");
Comments
Post a Comment