1

I'm trying to get that when a radio button within my app is selected, the application reloads. I've got the below code:

if(check.isSelected()== true){
    b1.setEnabled(true);
    finish();
    startActivity(getIntent());
}

However, the app doesn't seem to be entering the if statement even when the radio button is checked. Any ideas?

Rohit5k2
  • 17,948
  • 8
  • 45
  • 57
Scarlett
  • 131
  • 1
  • 2
  • 8

2 Answers2

2

Try like this.

if(check.isChecked()){
    b1.setEnabled(true);
    startActivity(getIntent());
    finish();
}

You are using startActivity after finish called. Also change the if condition

Amsheer
  • 7,046
  • 8
  • 47
  • 81
0

Change you code as below. Use this

if(check.isChecked()== true){ 
}

instead of

if(check.isSelected()== true){ 
}
Mayank Bhatnagar
  • 2,120
  • 1
  • 12
  • 20