override power button callback
Is it possible in an acitvity override the 开发者_开发百科callback called when the power button is pressed? My target is to prevent the screen off.
I found this - How to hook into the Power button in Android? -but it seems don't work.
THX
You can keep the screen on with a wake lock: http://developer.android.com/reference/android/os/PowerManager.html
But you should be carefull with it because it really drains the battery.
精彩评论