标签:
//广播监听事件类
public class HomeKeyEventBroadCastReceiver extends BroadcastReceiver{ @Override public void onReceive(Context context, Intent intent) { //do what you want System.exit(0); } }
private HomeKeyEventBroadCastReceiver homeKeyEventReceiver; protected void onResume() { super.onResume(); //监听Home建 homeKeyEventReceiver = new HomeKeyEventBroadCastReceiver(); registerReceiver(homeKeyEventReceiver, new IntentFilter(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)); }
@Override protected void onStop() { unregisterReceiver(homeKeyEventReceiver); super.onStop(); }
标签:
原文地址:http://blog.csdn.net/tanmengwen/article/details/42061399