Android
Android

Reputation: 133

Counting number of RadioGroups and RadioButtons

How to get the number of RadioGroups added dynamically in Layout and number of RadioButtons added in respective RadioGroup??

Upvotes: 0

Views: 130

Answers (1)

Purvil Bambharolia
Purvil Bambharolia

Reputation: 681

What you can do here is obtain a reference to the container of the layout. For Ex -

RelativeLayout rl=(RelativeLayout)findViewbyId(R.id.relative);
System.out.println(rl.getChildCount());

This will print the childs of the container view. If your layout contains only radiobuttons, your job is done.

Hope this helps! :)

Upvotes: 1

Related Questions