Suppose the user is in the activity A
of my application.
A B
. I do not want the activity B
to pop up from nowhere, I just want开发者_Go百科 that when (if) the user returns to my application, he sees the activity B
.
It seems that calling startActivity(B)
in the activity A
from a background thread works, but I’m not sure this will have the desired behaviour on every platform (what I want is that the user does not see the activity B
until he returns to my application)
I may not be following this correctly
If all you are after is saving state (which activity was last active) you could use preferences Shared Preferences
You could then just have a MainActivity that does nothing other than decide which activty should be displayed the next time your application starts
Main
Using preferences find the last activity that was active Start first activity dependent last activity ID or whatever logic you choose
Activity A or B starts/resumes etc - Store activity ID in shared preferences for retrieval later
精彩评论