版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/stimgo/article/details/86686183
- 在launch活动页面的onCreate()方法的setContentView()方法前面
添加
if (!this.isTaskRoot()) {
Intent mainIntent = getIntent();
String action = mainIntent.getAction();
if (mainIntent.hasCategory(Intent.CATEGORY_LAUNCHER) && Intent.ACTION_MAIN.equals(action)) {
finish();
return;
}
}
- 在启动页的清单配置里配
android:alwaysRetainTaskState="true"
android:clearTaskOnLaunch="false"