I have created RadioGroup and RadioButton dynamically as following:
RadioGroup
RadioButton
RadioGroup radioGroup = new RadioGroup(context);
In case for xml attribute its android:checkedButton which takes the id of the RadioButton to be checked.
android:checkedButton
id
....