0

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

Any help appreciated!

Lisa Anne
  • 4,482
  • 17
  • 83
  • 157
  • 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
  • 18,192
  • 4
  • 57
  • 80
Cunicio
  • 46
  • 2
1

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

Raghav Sood
  • 81,899
  • 22
  • 187
  • 195
1

Simply add this line in your onCreate() method:

getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
Kevin Coppock
  • 133,643
  • 45
  • 263
  • 274
0

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

Streets Of Boston
  • 12,576
  • 2
  • 25
  • 28