I used:
getWindow().addFlags(android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
How do I resume to Default state (no-keep-on)?>
Another approach
getWindow().setFlags(this.getWindow().getFlags() & ~WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
Also read this
and you can also set android:keepScreenOn="true" in the root View in xml.
android:keepScreenOn="true"