I have a boolean variable public static boolean isInDarkTheme but when I try to change the value in my settings activity it only gets changed tempolarily. I did it so:
if (on) {
//Do something when Switch button is on/checked
MainActivity.isInDarkTheme = true;
} else {
//Do something when Switch is off/unchecked
MainActivity.isInDarkTheme = false;
}
Log.d("DarkTheme", "SETTINGS " + MainActivity.isInDarkTheme);
in my settings the variable is changed but when I go back to my main with the arrow I created with this:
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
it is still the same in the main
but! when I use my software key to get back to the MainActivity it get saved picture with software back key
Any idea what I can do that it get saved with the other button?