问题描述
我开发的应用程序中,我想明确的退出按钮的点击都是我背栈。
我已经搜索并尝试了多种解决方案,给出,但它不是为我工作。
请如果有人可以帮助我,这将是AP preciated。
我曾尝试下面的注销按钮,点击code
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
和也试过以下清单文件code
的android:launchMode =singleTop
感谢您在高级
感谢名单给大家的宝贵回复
我已经找到一个解决方案,并试图这又是为我工作得很好。
意向意图=新意图(Settings.this,MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP |
Intent.FLAG_ACTIVITY_CLEAR_TASK |
Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(意向);
完();
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_CLEAR_TASK);
以上为我工作,但 Intent.FLAG_ACTIVITY_CLEAR_TASK
可从API 11
I am developing app in which i want clear all my back-stack on click of log out button.i have searched and tried many solutions given but its not working for me.please if anyone can help me that would be appreciated.
i have tried following code on click of log out button
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
and also tried following code in manifest file
android:launchMode="singleTop"
Thank you in advanced
Thanx to all of you for your valuable reply
i have found one solution and tried this again was worked for me fine
Intent intent = new Intent(Settings.this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP |
Intent.FLAG_ACTIVITY_CLEAR_TASK |
Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
finish();
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_CLEAR_TASK);
above is working for me but Intent.FLAG_ACTIVITY_CLEAR_TASK
is available from API 11
这篇关于在Android应用程序中清除backstack按钮点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!