3

I'm using this code in my AsyncTask to make sure the screen stays bright while the AsyncTask runs:

getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

However, I don't want the screen to be forced to be bright after the AsyncTask has ran. How can I essentially 'undo' or 'turn off' that option?

Mxyk
  • 10,678
  • 16
  • 57
  • 76

1 Answers1

6

In your onPostExecute method in your AsyncTask call

getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

See this question for more help.

Community
  • 1
  • 1
Jack
  • 9,156
  • 4
  • 50
  • 75