I would like to turn a switch on and then off. I have tried it this way:
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
swtch.setChecked(true);
try {
Thread.sleep(200);
} catch (InterruptedException e) {
e.printStackTrace();
}
swtch.setChecked(false);
}
The switch will turn blue but will not move to the right. After the 200 ms it will turn gray again. It also says OFF the whole time. How can i make the switch move to ON and back to OFF again?