安卓:我如何完全删除该活动栈的活动?

2023-09-12 04:40:35 作者:绿水无忧

我有两个活动FirstActivity和SecondActivity。

I have two Activities FirstActivity and SecondActivity.

FirstActivity有一个意图过滤器主,发射器和默认。 SecondActivity仅仅是一个正常的活动,并没有其他的标志是在AndroidManifest设置。

FirstActivity has an intent filter MAIN, LAUNCHER and DEFAULT. SecondActivity is just a normal activity and no other flags is set in the AndroidManifest.

我的应用程序是C2DM启用,当接收到一个通知显示任务栏图标,并点击时,它会打开SecondActivity。

My application is C2DM enabled and when a notification is received a taskbar Icon is displayed and when clicked it opens SecondActivity.

的通知到达有两种情况: 首先,我的应用程序运行时,通知到了,我的第二个应用是完全没有运行。

Arrival of Notifications has two scenarios: First, My Application is Already Running when notification arrived and second My Application is totally not running.

在第一种情况下,一切都很好。收到通知后,我从通知下拉点击,显示我的SecondActivity。当我preSS回SecondActivity完成和应用进入后台。当我重新开始我的应用程序,从最近的应用程序,它会显示FirstActivity这是正确的,因为它的主体,发射器和默认。

On the first scenario, everything is fine. A notification is received, i clicked from the notification drop down and my SecondActivity is displayed. When I press back SecondActivity is finished and application goes to the background. When I start my application again from Recent Applications, it displays FirstActivity which is correct since its the MAIN, LAUNCHER and DEFAULT.

在第二个方案中,收到了一个通知,我从通知下拉点击它,并显示我的SecondActivity。当我preSS回SecondActivity完成和应用进入后台。当我重新开始我的应用程序,从最近的应用程序,它会显示SecondActivity这是不对的。我期待FirstActivity来显示,因为它应该是一个全新的开始。

On the Second Scenario, A notification is received, I clicked it from the notification drop down and my SecondActivity is displayed. When I press back SecondActivity is finished and application goes to the background. When I start my application again from recent Applications, it displays SecondActivity which is wrong. I am expecting FirstActivity to be displayed because it should be a fresh start.

我试过ForceKilling第二个方案中应用后,但结果是一样的,我需要重新启动我的手机能够从FirstActivity重新开始。

I tried ForceKilling the application after the second scenario but the result is the same, I needed to restart my phone to be able to start from FirstActivity Again.

有你们遇到同样的问题?或者是它只是我吗?你认为什么是错的我的配置?

Have you guys encountered the same problem? or is it just me? What do you think is wrong with my configuration?

我也尝试设置noHistory = false以SecondActivity但还是结果都是一样的。

I also tried setting noHistory=false to SecondActivity but still the results are the same.

推荐答案

这是正确的行为。如果你开始通过最近的应用程序的应用程序,它将指向的最后一项活动。 尝试通过正常的应用程序列表中启动它

It is the correct behavior.. if you start the application through "Recent Application" it will point from the last activity. Try launching it through normal application list

相关推荐