Android: How to turn screen on and off programmatically?

后端 未结 16 2286
醉酒成梦
醉酒成梦 2020-11-22 13:05

Before marking this post as a \"duplicate\", I am writing this post because no other post holds the solution to the problem.

I am trying to turn off the device, then

16条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-22 13:34

    Simply add

    android:keepScreenOn="true" 
    

    or call

    setKeepScreenOn(true) 
    

    on parent view.

提交回复
热议问题