- 添加以下代码
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if(keyCode == KeyEvent.KEYCODE_BACK){ moveTaskToBack(true); return true; } return super.onKeyDown(keyCode, event); }
- 修改AndroidManifest.xml,在对应的activity中添加android:launchMode="singleInstance"