简体   繁体   English

应用程序在按android中的“主页”按钮后被杀死时无法打开主要活动

[英]Application not open main activity when it is killed after pressing home button in android

In my application activity A calls activity B. In activity BI press home button. 在我的应用程序活动A中调用活动B。在活动BI中按主页按钮。 and after sometime application is killed. 一段时间后,申请被终止。 But when I open my app again it opens B instead of activity A even though application is killed before. 但是,当我再次打开我的应用程序时,即使应用程序之前被杀死,它也会打开B而不是活动A。

Normally when you press home button your current activity is not killed by os. 通常,当您按下主屏幕按钮时,当前活动不会被os杀死。 To solve you problem place this 为了解决您的问题,将其放置在这里

android:noHistory="true"

in manifest file in your Activity B tag. 在您的Activity B标签的清单文件中。 Your activity won't be remembered and when you run your application next time, it will bring you to Activity A 您的活动将不会被记住,当您下次运行应用程序时,它将带您进入活动A

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

相关问题 在Android中按下主页按钮后应用程序被杀死时不会打开主要活动 - Application not open main activity when it was killed after pressing home button in android 应用程序被杀后如何打开主要活动? - How to open main activity when application was killed? 按HOME按钮后,应用程序启动应用程序主要活动的新实例 - After pressing HOME button, application starts a new instance of the application's main activity 当按下主页按钮时,活动被Android杀死 - Activity is getting killed by android when home button is pressed Android - 按下主页按钮后,Activity会从处理程序开始 - Android - Activity is starting from handler after sometime of pressing home button Android清单文件:用户在按下主屏幕按钮后恢复应用程序时,始终从Bean中启动应用程序 - Android manifest file: always start application from the beaning when user resuming the application after pressing the home button 当按下主页按钮,查看其他活动时,服务仍绑定到主要活动 - Service still bound to main activity when pressing home button, when viewing different activity 按home键后保存Activity的状态 - After pressing home button saving the state of Activity 按下主页按钮并返回活动后无声音 - No sound after pressing home button and returning to activity 即使按下主页按钮,活动仍然可见 - Activity visible even after pressing home button
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM