I have checkbox in preferences. I want to keep screen on if checkbox is checked and not to keep screen on if checkbox is not checked.
I want something like this:
boolean keepScreen = sharedPrefs.getBoolean("chck_screen", false);
if (keepScreen.equals(false)) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
Please, help.