vendredi 24 mars 2017

Can't re-enable a view after disabling it with CheckBox

I'm trying to enable/disable a seekbar when a checkbox is checked(or not).

I'm using this to create and refer:

CheckBox checkBoxProva = (CheckBox) findViewById(R.id.checkbox_prova);
boolean varCheckBoxProva = checkBoxProva.isChecked();

And this simple if to disable/enable the view:

if (!varCheckBoxProva) {
    seekBarProva.setEnabled(false);
}

All this is inside the onCreate.

When the app starts the seekbar is disabled (so the if works), but if I check the CheckBox it doesn't change to enabled.




Aucun commentaire:

Enregistrer un commentaire