Please I need to to keep the screen on while my activity is in the foreground.
Any help appreciated!
Acquire a Wake Lock or add android:keepScreenOn="true"
to any of the Views used in that Activity.
Simply add this line in your onCreate() method:
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
Make sure that its contents has a View that has set its keepScreenOn
field/attribute to true
.