I realize there are several topics about this issue, but none provides a working solution for me, so I'm posting this problem again and hopefully can get some solutions/suggestions.
So what's happening is, I have an application that contain 2 activities. The first one is for Login, for now I haven't implemented the login feature and all it does is click a button and the second activity gets launched. The second activity then displays a map, centered by user current location. It also contains a logout button to go back to the 1st login activity.
Now the login activity is the LAUNCHER activity because I apparently want user to login when they first open this app. Then after login button clicked I start the 2nd map activity and finishes the 1st.
However, if I leave the 2nd map activity by hitting home button, The map activity is put to run in the background. Now, if I open this app from the 'recent' opened app list, it will go back to the 2nd map app, which is desired. But if I open from the app list on android desktop. then it will launch a new instance of 1st login activity, instead of resume to where I left (the 2nd map activity). And the map activity is just behind it in the stack (I think) because in the newly launched login activity, if I hit back, it actually return to the map activity as where I left it.
in short, I wish to launch the app from the saved instance of this app, if there is one. I have seem this and it's not quite my problem.
I hope this is a clear description of my problem. Here are the relevant codes. I'm using Mono for Android to code, but I don't think it matters.
Login : Activity
loginButton.Click += delegate
{
StartActivityForResult(typeof(MapDemo), 0);
Finish();
};
MapDemo : MapActivity
logoutButton.Click += delegate
{
var intent = new Intent();
SetResult(Result.Ok, intent);
Finish();
};
Here are some links I found that has similar problem as I do.
Start activity after Resume
http://forum.xda-developers.com/showthread.php?t=856386
Android Resume Activity
I realize it might be because of I'm using the StartActivityForResult method incorrectly. It is a bit different using mono, but if you have a guess about what my problem might be, please point it out for me. Thank you a lot!