从历史-activity;移除];启动&QUOT [英] Remove "start"-activity from the history
问题描述
可能重复:
活动
<一href="http://stackoverflow.com/questions/1898886/removing-an-activity-from-the-history-stack">Removing从历史堆栈
我要寻找一个解决方案,以从历史堆栈中删除StartActivity。 的StartActivity是正在启动之初的之一。我使用这个类来检查一些用户价值并希望将用户重定向到MainActivity如果一切是正确的。
我试图设置一个标志:
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
但这并不做什么,它应该。
应用程序启动 - &GT; StartActivity - &GT; MainActivity - &GT; $ P $干燥综合征回来 - &GT;该应用程序应该结束
它的作用:
应用程序启动 - &GT; StartActivity - &GT; MainActivity - &GT; $ P $干燥综合征回来 - &GT; StartActivity
感谢您的帮助!
编辑:这是$ C $词现在用启动MainActivity:
意向书我=新的意图(背景下,DashBoardActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(ⅰ);
您应该使用 FLAG_ACTIVITY_NO_HISTORY
开始StartActivity实现描述的行为时。
同样的,如果你设置你可以达到 noHistory
属性真正在你的AndroidManifest.xml
。
Possible Duplicate:
Removing an activity from the history stack
I am looking for a solution to remove the StartActivity from the history stack. The StartActivity is the one that is being started at the beginning. I am using this Class to check some user values and want to redirect the user to the MainActivity if all is correct.
I have tried to set a flag:
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
but this does not do what it should.
App starts -> StartActivity -> MainActivity -> PRESS back -> the app should end
it does:
App starts -> StartActivity -> MainActivity -> PRESS back -> StartActivity
Thank for your help!
Edit: This is the code i am using to start the MainActivity:
Intent i = new Intent(context, DashBoardActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
You should use FLAG_ACTIVITY_NO_HISTORY
when starting StartActivity to achieve described behaviour.
The same you may achieve if you set noHistory
attribute to true
in your AndroidManifest.xml.
这篇关于从历史-activity;移除];启动&QUOT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!