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"
精彩评论