What I wanted to achieve is this: Right after the activity starts, I want that no RadioButton is selected/checked.
My problem is this: When the activity starts, the first RadioButton is always selected/checked.
I tried radioButton1.setChecked(false)
right after initialization of the radiobutton(inside onCreate), but when the activity starts, I can't manually check/select the first radiobutton. Till I select the 2nd or 3rd radio button, I can now select/check the first radio button.
If you want to uncheck all the radio buttons and checkboxes you will need to add one single line (in bold): $('#clear-all'). click(function () { $(':checkbox'). each(function () { $(this).
To set a radio button to checked/unchecked, select the element and set its checked property to true or false , e.g. myRadio. checked = true . When set to true , the radio button becomes checked and all other radio buttons with the same name attribute become unchecked.
You can't uncheck a checked RadioButton. The only way to uncheck is to select some other RadioButton belonging to that RadioGroup.
RadioGroup radioGroup = (RadioGroup)findViewById(R.id.radiogroup); radioGroup.clearCheck();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With