I am developing an quiz based app. There will be 1 question and 4 option (radio buttons) when user opens this app radio button will be unchecked but the problem comes when the u
Put all your buttons in a RadioGroup
then when you need to clear them all use RadioGroup.clearCheck();
I think the problem is with btn_practicerg object i.e if you are creating new RadioGroup object everytime you display a new question then you have to execute RadioGroup.clearCheck() on new btn_practicerg object instead of old one that I think you are doing currently.
Even better:
btn_practice1.setText(answ1.get(0));
btn_practice2.setText(answ1.get(1));
btn_practice3.setText(answ1.get(2));
btn_practice4.setText(answ1.get(3));
btn_practice1.setChecked(false);
btn_practice2.setChecked(false);
btn_practice3.setChecked(false);
btn_practice4.setChecked(false);
to uncheck all the buttons in the beginning. I hope this will solve your problem.
if the Radiobutton belong to a radiogroup you can NEVER unchecked alone that button programaticaly, so you must to do a method to unched all first.
public void unchecked()
{
RadioGroup x=findViewById(R.id.NameOfRadiogroup);
x.clearCheck();
}
and then you must to call the method.