I have an app that uses radio buttons. The default for this button is set in the main.xml file, ie:
android:id="@+id/rb_sat1E"
android:checked="true"
In the Java file I have:
final RadioButton radio1 = (RadioButton)findViewById(R.id.rb_sat1E);
I have also created a 'Reset' button in the main Java file and can use the following code to reset TextView information ie.
pos1_deg.setText("0.0");
But how do I reset a radio button? I would have thought it to be something like
radio1.setBoolean("TRUE");
But that does not work at all.
Any help greatly appreciated. Thanks.
For radioButton use
radio1.setChecked(true);
It does not make sense to have just one RadioButton. If you have more of them you need to uncheck others through
radio2.setChecked(false); ...
If your setting is just on/off use CheckBox.