Good morning folks, I have the following problem: I have a switch button that when I turn it ON starts playing an mp3 file, so all right, the problem is that when I change the screen (ie I change the orientation) and I go back to return to the screen in which I had the switch button, it appears as OFF, my question is if there is any way to keep it ON when I change the screen and return to it.
This is my code:
swtMusic.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if(isChecked){
mp.start();
swtMusic.setSaveEnabled(true);
}
else{
mp.stop();
swtMusic.setChecked(false);
}
}
});