Android的显示最近的活动重新启动一个应用程序后,重新启动、应用程序、最近、Android

由网友(阳光的暖冬)分享简介:我有一个活动中号这是主要 活动。我可以访问 b活动从活动中号和其他活动ç从 b活动。I have an Activity M which is the main Activity. I can access an Activity B from Activity M and another Activity C fr...

我有一个活动中号这是主要 活动。我可以访问 b活动活动中号和其他活动ç b活动

I have an Activity M which is the main Activity. I can access an Activity B from Activity M and another Activity C from Activity B.

所以 M - > B - > C

So M -> B -> C.

在我目前在活动ç和preSS在我的设备的底部,(在其中一个让我回到主屏幕按钮。怎么叫这个按钮呢?),然后再次单击我的应用程序图标,它将启动活动中号而不是活动ç,虽然最后表示活动是 C

When I am currently in the Activity C and press the button on the bottom of my device, (the one which brings me back to the home screen. How is this button called anyway? ) and then click on my application icon again, it will start the Activity M instead of Activity C, although the last shown activity was C.

所以 M - > B - > C - >家里通过按钮点击屏幕 - >点击应用程序图标 - > M

So M -> B -> C -> home screen through button click -> click on application Icon -> M

但我要的是 M - > B - > C - >家里通过按钮点击屏幕 - >点击应用程序图标 - > C

But what I want is M -> B -> C -> home screen through button click -> click on application Icon -> C

我希望我的问题是清楚的。有谁知道如何关闭/暂停对应用程序的应用之前显示我的最后一个显示活动的重启的?

I hope my problem is clear. Does anyone know how to show my last shown activity before closing / pausing the application on application restart?

推荐答案

试试这个...

 @Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0) { 
        // Activity was brought to front and not created, 
        // Thus finishing this will get us to the last viewed activity 
        finish(); 
        return; 
    } 

    // Regular activity creation code... 
} 

这将始终打开从那里的应用程序退出的最后一项活动......

This will always open the last activity from where the app was exited.....

阅读全文

相关推荐

最新文章