Reputation: 6083
I have a RadioGroup with 3 RadioButtons and a Button in my XML file. How can I get the ID of the checked RadioButton when I hit the Button (I have an OnClickListener set for this button)? Later I want to use Switch statement inside onClick, after checking which RadioButton is checked.
Thank you!
Upvotes: 0
Views: 230
Reputation: 12642
you can use this
yourRadioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
// TODO Auto-generated method stub
}
});
Upvotes: 1