简体   繁体   English

如果我的应用程序是从最近的应用程序屏幕启动的,如何防止后退按钮退出我的应用程序?

[英]How do I prevent the back button from exiting my app if it was launched from recent apps screen?

When I launch my activity from the recent apps menu (using a long click on the home screen) and then hit the back button (once the app is launched), the app exits and returns to the home screen.当我从最近的应用程序菜单启动我的活动(在主屏幕上长按)然后点击返回按钮(一旦应用程序启动),应用程序退出并返回到主屏幕。 The behavior I would have expected is that the entire application activity stack is reloaded, so hitting back would finish the current activity and go down one level in the stack inside my application.我所期望的行为是重新加载整个应用程序活动堆栈,因此回击将完成当前活动,并且 go 在我的应用程序内的堆栈中下降一级。

What am I doing wrong?我究竟做错了什么? Is there a setting in my AndroidManifest.xml that I should keep an eye out for?我的 AndroidManifest.xml 中是否有我应该留意的设置?

Thanks in advance.提前致谢。

Bringing back the whole task stack should be the default behavior.带回整个任务堆栈应该是默认行为。 Do you call finish() on your activities or set nohistory in manifest?您是否在活动中调用完成()或在清单中设置 nohistory ? If so, that explains it.如果是这样,那就解释了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 防止退出按钮退出cordova应用程序 - Prevent back button from exiting cordova app 在Android中如何阻止用户按住主页按钮显示最近启动的应用程序? - In Android how do I prevent the user from holding the home button to display recently launched apps? 如何在最近的应用程序列表中显示我的应用程序和浏览器是作为意图启动的? - How to show my app and browser launched as an intent in the recent apps list? 如何在按下“后退/主页”按钮时阻止我的应用退出? - How to stop my app from exiting when back/home button button is pressed? Android-从操作系统的应用程序“最近使用的应用程序”列表中启动的活动 - Android - Activity launched from the OS's app recent apps list 锁定屏幕后,如何防止我的应用旋转/阻止方向开关? - How do I prevent my app from rotating /prevent the orientation switch once I lock the screen? 从通知启动应用程序时如何重新创建最近的应用程序活动 - How to recreate recent-apps activity when app is launched from notification 在 android 设备中,当我单击后退按钮直到返回主屏幕时,为什么该应用程序没有从最近删除? - In android device When I click back button till go back to home screen why the app is not removed from recent? 如何防止文本退出屏幕 - How to prevent text from exiting the screen 当按下后退按钮时,我的应用程序关闭了最近的应用程序 - When pressed back button, my app dismiss recent apps
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM