I am developing an application using a toggle button, I entered 1 or 0 in EditText
. When button is clicked, the toggle button has to change if I enter 1 the tog
You should follow the Google guide;
ToggleButton toggle = (ToggleButton) findViewById(R.id.togglebutton);
toggle.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
// The toggle is enabled
} else {
// The toggle is disabled
}
}
});
You can check the documentation here