Keep the screen awake throughout my activity

后端 未结 5 1174
说谎
说谎 2020-12-04 21:03

I have three activities in my app. I want to keep the screen awake when it is in the second activity. The screen should not go off in my second activity unless the \"lock\"

5条回答
  •  温柔的废话
    2020-12-04 21:26

    try to use this

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

提交回复
热议问题