fun getSelected() {
val radioGroup = findViewById<RadioGroup>(R.id.rgColors)
val color = when(radioGroup.checkedRadioButtonId) {
R.id.rbBlue -> "Blue"
R.id.rbGreen -> "Green"
R.id.rbRed -> "Red"
else -> "Other
}
}
// get selected radio button from radioGroup
int selectedId = radioGroup.getCheckedRadioButtonId();
// find the radiobutton by returned id
radioButton = (RadioButton) findViewById(selectedId);
Toast.makeText(MyAndroidAppActivity.this,
radioButton.getText(), Toast.LENGTH_SHORT).show();
int radioButtonID = radioButtonGroup.getCheckedRadioButtonId();
View radioButton = radioButtonGroup.findViewById(radioButtonID);
int idx = radioButtonGroup.indexOfChild(radioButton);
int radioButtonID = radioButtonGroup.getCheckedRadioButtonId();
View radioButton = radioButtonGroup.findViewById(radioButtonID);