How to get the status of ToggleButton
if it is turned on or off, I looked at the documentation of Android only has the method to change the state, had to pick the state of the button to make the comparison.
How to get the status of ToggleButton
if it is turned on or off, I looked at the documentation of Android only has the method to change the state, had to pick the state of the button to make the comparison.
The method is isChecked (). It is inherited from the CompoundButton class.
Ex:
if(myToggleButton.isChecked())
// Faça algo se estiver checado
else
// Faça algo se não estiver checado