I have multiple radio buttons which I want to layout using a table but also include them in a single radio group. I have the following xml layout:
rg1 = (RadioGroup)findViewById(R.id.radioGroup1);
rg2 = (RadioGroup)findViewById(R.id.radioGroup2);
rg1.setOnCheckedChangeListener(this);
rg2.setOnCheckedChangeListener(this);
}
boolean rg1b = false;
boolean rg2b = false;
@Override
public void onCheckedChanged(RadioGroup rgId, int radioButtonId) {
switch (rgId.getId()) {
case R.id.radioGroup1:
rg1b=true;
if(rg2b)
rg2.clearCheck();
break;
case R.id.radioGroup2:
rg1b=true;
if(rg1b)
rg1.clearCheck();
break;
}