I have developed an quiz based android application in which I'm loading question and answers from an array everything works fine but only issue I'm facing is after selecting an option for a particular question and submitting it the selected option remains selected for the next question also here I need to clear the checked option. Here is what I have tried
b1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
RadioButton uans = (RadioButton)findViewById(rg1.getCheckedRadioButtonId());
String ansText = uans.getText().toString();
//Toast.makeText(getApplicationContext(), ""+ansText, 5000).show();
if(ansText.equalsIgnoreCase(answers[flag]))
{
correct++;
}
else
{
wrong++;
}
//Toast.makeText(getApplicationContext(), "Flag before INCR==> " + flag, 5000).show();
flag++;
if(flag < ques.length)
{
//Toast.makeText(getApplicationContext(), "Flag after INCR==> " + flag, 5000).show();
rg1.setEnabled(false);
t2.setText(ques[flag]);
r1.setText(options[flag*4]);
r2.setText(options[flag*4 + 1]);
r3.setText(options[flag*4 + 2]);
r4.setText(options[flag*4 + 3]);
}