How can I uncheck or reset the radio button?

后端 未结 3 846
我在风中等你
我在风中等你 2021-02-11 16:58

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

3条回答
  •  感情败类
    2021-02-11 17:46

    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.

提交回复
热议问题