android - 清除堆栈而不调用 startActivity()
问题描述
我正在进行某个活动,如果某个条件为真,我想清除所有先前的堆栈。
if (condition_is_true) {
// Clear stack
}
我不能使用:
因为,我想先检查条件
<activity android:name=".CurrentActivity" android:noHistory="true" />
因为,我不想开始新的活动
Intent nextIntent = new Intent(CurrentActivity.this, NextActivity.class); nextIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(nextIntent);
解决方案
推荐阅读
- python - 如何让我的方法返回一个列表而不是字符串?
- python - 尝试在 Python 中将时间戳转换为毫秒。出现格式错误
- python - 未创建类
- powershell - 如何完成包装功能?
- python - 如何让我的不和谐音乐机器人识别一首歌曲播放完毕,以便播放下一首歌曲?
- python-3.x - Pyplot 不显示 WSL 中的图(Ubuntu 18)
- c# - LINQ Lambda 用于创建包含来自 3 个相关表的信息的列表
- redirect - 使用 ID 查询重定向数千个帖子的规则
- go - 用描述定义一组常数的最佳实践是什么
- loops - 想知道在游戏中重复while循环是如何工作的