0

Please I need to to keep the screen on while my activity is in the foreground.

Any help appreciated!

Lisa Anne
  • 4,654
  • 16
  • 75
  • 151
  • Possible duplicate: http://stackoverflow.com/questions/8442079/keep-the-screen-awake-throughout-my-activity?rq=1 – Geobits Feb 27 '13 at 20:36

4 Answers4

3

You might want to use: keepScreenOn and setKeepScreenOn().

Please see this link

iTech
  • 17,764
  • 4
  • 54
  • 78
Cunicio
  • 46
  • 2
1

Acquire a Wake Lock or add android:keepScreenOn="true" to any of the Views used in that Activity.

Raghav Sood
  • 80,914
  • 21
  • 183
  • 190
1

Simply add this line in your onCreate() method:

getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
Kevin Coppock
  • 131,356
  • 43
  • 258
  • 273
0

Make sure that its contents has a View that has set its keepScreenOn field/attribute to true.

Streets Of Boston
  • 12,436
  • 2
  • 24
  • 27