I have an Activity that usually needs some time to watch the screen without interacting with it.
Activity
The problem is that the screen turns off, just like wit
To change it on-the-fly do this:
if (keepScreenOn) getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); else getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);