0
I have a Switch component and would like to get its status whether it’s on or off. When searching on the net the examples that I got didn’t work but one worked but it only takes the value when I change on/off because of the function setOnCheckedChangeListener
I’d 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";
}
}
});
Avoid using uppercase variable names
– Leonardo Dias
Please mark your response as certain if it has helped you.
– LMaker