Android: keep task's activity stack after restart from HOME

前端 未结 3 1163
野的像风
野的像风 2020-12-01 13:05

My application has two activities, that I start in this order:

HOME > A > B

Now I press HOME and launch \"A\" again. I would like to

相关标签:
3条回答
  • 2020-12-01 13:42

    It's not that complex. You just need to manipulate the manifest.

    AndroidManifest.xm

    <activity
         android:name=".MainActivity"
         android:alwaysRetainTaskState="true"
         android:exported="true"
         .
         .
         .
    

    Read about the 'android:exported' & 'android:alwaysRetainTaskState' here:

    android:exported

    android:alwaysRetainTaskState

    0 讨论(0)
  • 2020-12-01 13:45

    I figured out what is wrong...

    The config is right, but I started application for debugging from Eclipse, this was the issue.

    Case # 1.

    Debug > A > B > HOME > A
    Get: A (stack is cleared)
    

    Case # 2.

    Debug > A > BACK > A > B > HOME > A
    Get: B (stack preserved)
    

    Case # 3.

    A > B > HOME > A
    Get: B (stack preserved)
    
    0 讨论(0)
  • 2020-12-01 13:53

    We have discovered this is a known Android issue - it has been officially tracked here and here.

    Despite they say (did not checked) it has been fixed in the 0.9.6 release of the ADT Eclipse plugin I still can see this on a real device during the application OTA upgrade. At least this happens for Android 1.6, 2.0.1, 2.1 and 2.2.

    We've created a workaround for this issue. Check it out here.

    0 讨论(0)
提交回复
热议问题