Hi. I noticed something similar while developing for android...that is: when I start the app from eclipse (either "debug as", or "run as") launching Activity 1, then go to Activity 2, then press Home, and then restart the app, I see that Activity 1 is shown (while Activity 2 should be on top of the stack). If I press "back" I get my running Activity 2... To avoid that, when the app starts, the first thing I do is "quit" (by pressing "back"). Then I start the app again (Activity 1), launch Activity 2, then press Home, and restart...I get correctly Activity 2...
I really don't know why it happens (I noticed that also when starting apps downloaded from the Market, and launched directly from the notification status bar). Btw I didn't specify any launch mode (singleTask, singleInstance, etc..). Maybe you should try removing that too.. Ciao! Yuvi On Sat, Jan 23, 2010 at 11:22 PM, Josh Hoffman <[email protected]> wrote: > Thanks for your help Vo Trung Liem, I think I may not have been clear > enough about what I'm trying to do. I don't have any trouble getting > back to Activity1 (my launcher) from Activity2 (results). What I want > is this: > > Launch app into Activity1 from the home screen. > Go into Activity2 from Activity1 after choosing options. > Be able to hit the 'Home' key and use other apps while my app does > work. > Launch app into Activity2 from the home screen. > > What I currently have is an app that will only ever launch into > Activity1 from the home screen no matter what I do. It doesn't seem to > care whether Activity2 was on top of the stack when I hit home, which > tells me I probably don't understand the Android Lifecycle as well as > I should. I should probably also mention that I am using > android:launchMode="singleTask" as I am under the impression that this > makes sure I only ever have one instance of my application floating > around. > > Thanks again for reading and for any help you may be able to offer! > > On Jan 22, 6:21 pm, Vo Trung Liem <[email protected]> wrote: > > Hi, > > > > No need set up your Manifest to get this functionality. > > > > You just use function onActivityResult() to code for your functionality. > > > > Example: > > > > Activity1 call Activity2 then Activity1 will resume after Activity2 > finish. > > > > Activity1 will call Activity2 by function: startActivityForResult(intent, > > requestCode); > > > > In Activity2, we need implement function onActivityResult() what you > want. > > (Example: setResult(0); > > this.finish();) > > > > Hope you success! > > > > On Sat, Jan 23, 2010 at 7:09 AM, Josh Hoffman <[email protected]> > wrote: > > > I'm currently working with a two-activity application. The first > > > activity allows the user to choose options for their upload, and the > > > second activity displays a ListView of their results once processed. > > > > > I have code in place that performs the uploads/downloads in the > > > background, regardless of whether the application is currently in > > > focus or not (thanks to Matthias Kaeppler's Droid-Fu). > > > > > I would like to have my application Resume into my second (results) > > > activity when a user clicks on the icon from the top-level launcher, > > > regardless of how long they have been away from the app. I thought > > > that the 'alwaysRetainTaskState' flag in the Manifest would do it, but > > > I've not had success with that. Can anyone tell me how I need to set > > > up my Manifest to get this functionality? > > > > > Thank you for your help! :) > > > > > -- > > > You received this message because you are subscribed to the Google > > > Groups "Android Developers" group. > > > To post to this group, send email to > [email protected] > > > To unsubscribe from this group, send email to > > > [email protected]<android-developers%[email protected]> > <android-developers%[email protected]<android-developers%[email protected]> > > > > > For more options, visit this group at > > >http://groups.google.com/group/android-developers?hl=en > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

