I have a Switch component and would like to get its status if it is on or off. When searching the net for the examples I got it did not work but it worked fine but it only takes the value when I make the on / off change because of the setOnCheckedChangeListener
I would like to know a way to get the value.
Delivery would be my Switch.
Entrega.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if(Entrega.isChecked()){
StatusEntrega = "Receber na Mesa";
}else{
StatusEntrega = "Receber no Balcão";
}
}
});