Hm. The difference between task state and activity stack is not easy
to grasp (for me). You always start a new activity-stack when you
return to Home as I understand it. At any point you can switch to
another task by long-pressing Home to get the recent task list.
If Activity1 and Activity2 are part of the same task and Activity2 is
foreground when pressing the Home key, then I thought that choosing
that app on the Home screen would return you to Activity2. This is
what the OP expected and what I expect too.
See for instance #3 ("Switch to first task...") at this link -
http://developer.android.com/intl/fr/guide/practices/ui_guidelines/activity_task_design.html#switching_between_tasks
What is the launchmode in the manifest for Activty1 and Activity2?
On Jan 24, 11:43 am, Dianne Hackborn <[email protected]> wrote:
> Set android:launchMode="singleTop" on your first activity. You will then
> get an onNewIntent() when you are re-launched from home. There you can
> startActivity() for your second activity; if you want back from the second
> activity to skip the first, you can call finish() in the first after
> starting the second.
>
> You may want to do the same thing in onCreate() (when savedState is null),
> to take care of the case where they launch your activity after finishing it
> via back.
>
>
>
> On Sat, Jan 23, 2010 at 3:08 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
>
> --
> Dianne Hackborn
> Android framework engineer
> [email protected]
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails. All such
> questions should be posted on public forums, where I and others can see and
> answer them.
--
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