문제

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?

도움이 되었습니까?

해결책

In your onPostExecute method in your AsyncTask call

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

See this question for more help.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top