Immediately after installing my app (side-loaded APK file), the package 
installer gives the option of "Done" or "Open".  If I select "Open", it 
will immediately launch my app's main activity.  From that main activity in 
my app, I start a second activity with startActivityForResult.  The second 
activity displays.  Now I press "Home" to go to the device's home screen.  
So far all is working as it should.  But now, I find the icon for my app 
and tap on that icon.  What should I see?  Well, I expect to see that 
second activity of my app, which is the state my app was in when I last 
left it by pressing "Home".  But instead I see my app's main activity 
again.  And if now press the system "Back" button, I do get back to that 
second activity, as if that second activity has launched the main 
activity.  The "stack" of activities seems messed up.

The reason I say this is due to the package installer is that if I try the 
same experiment, but instead of starting from a fresh install, I start from 
an initial launch from the device's home screen, everything behaves as it 
should.  That is, I first see my main activity, I go to the second 
activity, I press Home, then I launch my app again, I see the second 
activity, just as I should.

What the the reason for the different behavior when starting an app 
directly from the package installer?  Are there two instances of my app for 
a while?  Why should it behave differently based on how it was initially 
launched?


-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/82215977-def3-4c92-a248-ed730983887c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to