0
I created a switch that turns bluetooth on and off. However, when connecting, it asks the user if he really wants to activate bluetooth. If the user clicks no, the switch remains active and the app crusha.
Does anyone know how to get the Switch back to its initial position if the user clicks not ?
I am using On checked as below:
comum.setOnCheckedChangeListener(new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
// Ligado
} else {
// Desligado
}
}
});
Thank you very much, I’m new here.
– Antonio Ortiz
buttonView.isChecked = false
. Take into account that this will eventually make the methodonCheckedChanged()
be called again.– ramaral
Thank you very much, it makes sense, really worth !!!
– Antonio Ortiz