Note that there are some explanatory texts on larger screens.

plurals
  1. POLaunch from saved instance
    text
    copied!<p>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.</p> <p>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.</p> <p>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.</p> <p>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.</p> <p>in short, I wish to launch the app from the saved instance of this app, if there is one. I have seem <a href="https://stackoverflow.com/questions/151777/how-do-i-save-an-android-applications-state">this</a> and it's not quite my problem. </p> <p>I hope this is a clear description of my problem. Here are the relevant codes. I'm using <b>Mono for Android</b> to code, but I don't think it matters.</p> <pre><code>Login : Activity loginButton.Click += delegate { StartActivityForResult(typeof(MapDemo), 0); Finish(); }; MapDemo : MapActivity logoutButton.Click += delegate { var intent = new Intent(); SetResult(Result.Ok, intent); Finish(); }; </code></pre> <p>Here are some links I found that has similar problem as I do.</p> <p><a href="https://stackoverflow.com/questions/8594279/start-activity-after-resume">Start activity after Resume</a><br> <a href="http://forum.xda-developers.com/showthread.php?t=856386" rel="nofollow noreferrer">http://forum.xda-developers.com/showthread.php?t=856386</a><br> <a href="https://stackoverflow.com/questions/2767869/android-resume-activity">Android Resume Activity</a></p> <p>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!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload