gpt4 book ai didi

android - Activity 即使从方法 Intent.FLAG_ACTIVITY_CLEAR_TOP 也不要从返回堆栈中清除

转载 作者:行者123 更新时间:2023-12-04 23:55:19 28 4
gpt4 key购买 nike

我想转到另一个 Activity ,但在我想清除所有其他 Activity 之前。我知道 Intent.FLAG_ACTIVITY_CLEAR_TOP 方法,但是当我在移动后返回时它不起作用然后它再次显示前一个 Activity 。我的代码是

 Intent intent = new Intent(LoginActivity.this, WelcomeActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
progressDialog.dismiss();

提前致谢

最佳答案

添加三个标志:

 intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);

关于android - Activity 即使从方法 Intent.FLAG_ACTIVITY_CLEAR_TOP 也不要从返回堆栈中清除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60450934/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com