Set selected index of an Android RadioGroup
问题 Is there a way to set the selected index of a RadioGroup in android, other than looping through the child radiobuttons and selecting checking the radio button at the selected index? Note: I am populating the Radio Button Group at run time. 回答1: If your radio group is defined in a layout xml file, each button can be assigned an id. Then you just check a button like this radioGroup.check(R.id.myButtonId); If you created your radio group programmatically (I'm not even sure how you do this...),