There are two activities as A and B. There is two radio buttons as radio1 & radio2 on page B. when load B page after click button of A page first radio button need to view as checked/clicked .
Asked
Active
Viewed 783 times
0
-
in your xml add android:checked=true to whichever radio button you want to be checked – nishant Jan 02 '19 at 08:29
-
radio1.setChecked(true); will also work if done from java – vikas kumar Jan 02 '19 at 08:30
-
You need learn more bcz it is very simple , please find solution yourself. – Gautam Kushwaha Jan 02 '19 at 08:32
-
i already add android:checked = true. but its show radio button selected only in xml layout of android studio. not showing when run the app in emulator or real device.#nishant – Mash Jan 02 '19 at 08:35
-
1Possible duplicate of [how to set radio button checked as default in radiogroup with Android](https://stackoverflow.com/questions/9175635/how-to-set-radio-button-checked-as-default-in-radiogroup-with-android) – vikas kumar Jan 02 '19 at 09:16
1 Answers
2
In your XML file, you can set the following attribute on the radio button you want selected: android:checked="true"
Or programmatically, you can select the radio button by using the following method written in your onCreate:
RadioButton radioButton = (RadioButton) findViewById(R.id.radio1);
radioButton.setChecked(true);

Nero
- 1,058
- 1
- 9
- 25