How to reveal that screen is locked?
问题 In my application I need to know when device is locked (on HTC's it looks like short press on "power" button). So the question is: which event is triggered when device is locked? Or device is going to sleep? 回答1: You should extend BroadcastReceiver and implement onReceive , like this: public class YourBroadcastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if (Intent.ACTION_SCREEN_OFF.equalsIgnoreCase(intent.getAction())) { //screen has