I have 4 different radio buttons that I want to put in two different group. But the problem is I do not want to put buttons vertically or horizontally. I am putting them randomly on layout.
Now how can I apply group on each button?
Try this:
RadioGroup radioGroup1 = new RadioGroup(context);
RadioGroup radioGroup2 = new RadioGroup(context);
RadioButton radioBtn1 = new RadioButton(context);
RadioButton radioBtn2 = new RadioButton(context);
RadioButton radioBtn3 = new RadioButton(context);
RadioButton radioBtn4 = new RadioButton(context);
radioGroup1.addView(radioBtn1);
radioGroup1.addView(radioBtn2);
radioGroup2.addView(radioBtn3);
radioGroup2.addView(radioBtn4);