开发者

Disabling screen sleep Programmatically in Android?

Can you please tell me how to prevent the Android Activity from sleep mode programmatically. Or can we declare someth开发者_开发技巧ing related to this in Android Manifest file.


setKeepScreenOn(true)


You can do

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

You can add this code in your onCreate() method of your activity. or you can put it in your xml file

android:keepScreenOn="true"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜