I\'m creating a Android application which uses a Switch.
I\'m trying to listen for changes and get the value when changed.
I have two questions when usi
Switch switch = (Switch) findViewById(R.id.Switch2);
switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
...switch on..
} else {
...switch off..
}
}
});
i hope this will solve your problem