0

I've tried all launchMode's yet it does not seem to work:

Suppose App A has various activities, J & K. J is the initial one (to choose app mode), which calls K where the main things happen (after calling it, J finish()es). If i click "Home" button in K, and then open the app again, it opens a new instance of A with activity J.

I'd like it to open the paused K activity instead. Other threads mention an Android bug -- is there a way to fix it? Setting launchMode does not work :S

Thanks a lot.

user1264201
  • 75
  • 1
  • 9
  • Oh, curious thing: when J is opened after clicking home, clicking back shows the previous instance of K. – user1264201 Dec 27 '12 at 18:24
  • What you want is normal Android behaviour. The fact that it isn't working means that you are probably doing something strange. **Do not** try to solve this by playing around with launchModes. Please post the relevant parts of your manifest. There is, however, a bug which manifests itself like this. To see if this bug is causing your problem do the following: force-close your app on the phone. Now start your app from the list of apps on the phone. Go from ActivityJ to ActivityK. Press HOME. Open the app again. If it works now, you are just seeing the dreaded Android launch bug. – David Wasser Dec 27 '12 at 20:43
  • Wow, yes, it worked. It was the Android launch bug. Thanks a lot, you're great! (I would accept your answer, but since it's a comment I'm not able to.) – user1264201 Dec 28 '12 at 08:10
  • Cool. I created an answer from my comment. Glad to be of help. I added a few links to the bug issues for reference. – David Wasser Dec 28 '12 at 09:13

1 Answers1

0

What you want is normal Android behaviour. The fact that it isn't working means that you are probably doing something strange. Do not try to solve this by playing around with launchModes. Please post the relevant parts of your manifest. There is, however, a bug which manifests itself like this. To see if this bug is causing your problem do the following: force-close your app on the phone. Now start your app from the list of apps on the phone. Go from ActivityJ to ActivityK. Press HOME. Open the app again. If it works now, you are just seeing the dreaded Android launch bug.

For more details on the launch bug, see these issues:

http://code.google.com/p/android/issues/detail?id=2373

http://code.google.com/p/android/issues/detail?id=26658

The bug is there on all devices, on all versions of Android (at least up to ICS, haven't tested on JellyBean yet). It all works as it should in the emulator, so you cannot use emulator behaviour as an indication of real device behaviour.

David Wasser
  • 93,459
  • 16
  • 209
  • 274