代码
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
/**
* Starting: Intent {
act=android.intent.action.MAIN
cat=[android.intent.category.HOME
] cmp=com.android.launcher/com.android.launcher2.Launcher } from pid 208
*/
//跳转到主界面
Intent intent = new Intent();
intent.setAction("android.intent.action.MAIN");
intent.addCategory("android.intent.category.HOME");
startActivity(intent);
finish();
}
return super.onKeyDown(keyCode, event);
}