The following code will get the selected Index of the RadioGroup and also get the text of the selected RadioButton,
int radioButtonID = someRadioGroup.getCheckedRadioButtonId();View radioButton = someRadioGroup.findViewById(radioButtonID);int idx = someRadioGroup.indexOfChild(radioButton);RadioButton clickedRadioBut = (RadioButton) someRadioGroup.getChildAt(idx);String selection = (String) clickedRadioBut.getText();
No comments:
Post a Comment