//广播监听事件类
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://862123204-qq-com.iteye.com/blog/1888532
时间: 2024-09-29 09:54:26