why can't I check the same radio object after I remove it programmatically, when I press the next button, if I do not check another radio object.
This is the code that disables the radio buttons:
if(q.trim() != null || q.trim() != ""){ questionView.setText(q); r1.setChecked(false); r2.setChecked(false); r3.setChecked(false); r1.clearFocus(); r2.clearFocus(); r3.clearFocus(); r1.setText(varNames.get("ra0")); r2.setText(varNames.get("ra1")); r3.setText(varNames.get("ra2")); }
And this is where I am trying to verify this:
public void questionClicked(View view) { boolean checked = ((RadioButton) view).isChecked(); switch(view.getId()) { case R.id.firstQuestion: if(!checked) { r1.setChecked(true); } getAnswer(R.id.firstQuestion); break; case R.id.secondQuestion: if(!checked) { r2.setChecked(true); } getAnswer(R.id.secondQuestion); break; case R.id.thirdQuestion: if(!checked) { r3.setChecked(true); } getAnswer(R.id.thirdQuestion); break; } }
source share