android radiogroup radiobutton set checked code example
Example 1: android radiobutton setchecked
radioGroup.check(R.id.radioButtonId);
Example 2: radiogroup get selected item android
int radioButtonID = radioButtonGroup.getCheckedRadioButtonId();
View radioButton = radioButtonGroup.findViewById(radioButtonID);
Example 3: how to set radio button checked in android programmatically
In your layout you can add android:checked="true" to CheckBox you want to be selected.
Or programmatically, you can use the setChecked method defined in the checkable interface:
RadioButton b = (RadioButton) findViewById(R.id.option1);
b.setChecked(true);