简体   繁体   中英

android new task and activity stack issue

  1. I have my launcher activity (A) set to "singleTop".

  2. Now there is something in notification bar. User clicks on it. So I start activity in receiver with

    Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK

  3. So A's onNewIntent is invoked and I start activity C based on extras in intent.

  4. User go back to A(back key) and to other activity D. And then home key.

  5. Now when I long press home. And relaunch my application and step 3 repeats. and user goes to C. where actually user should have gone to D

Add android:launchMode="singleInstance" in Activity D (in the menifest file). And then check the app behaviour.

Somehow, when you press Long home and restart the activity, the extras parameters are lost.Only the data parameter is preserved.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM