I posted with this same problem before and then it just seemed to
"disappear" so I replied to my own post with a "never mind, it works
now" and no real resolution. Well, as I've continued to develop I've
run in to it again and figured out what is going on. There is a
problem with the development environment that causes this. When an app
is run through the IDE either on a real device hooked up to the USB
port or on the emulator it will exhibit this behavior as follows:
1. Hit run in IDE
2. App launches with activity A
3. Navigate to activity B
4. Press the home button
5. Click the app icon to return to the app
6. App appears with activity A on top
7. Press back and activity B is revealed, back again returns to
activity A, and a third back returns to the home screen

This problem is present for every combination manifest and activity
launch options that I have tried.
The problem is avoided by exiting the app after hitting run in the
IDE:
1. Hit run in the IDE to load the new version of the app but DO NOT
use it when it runs
2. Hit back to exit the app and return to the home screen
3. Launch the app from the icon, activities will work properly now
4. Navigate from A to B
5. Hit home
6. Click the app icon, you are turned to B as expected

On Apr 4, 9:58 pm, Dianne Hackborn <hack...@android.com> wrote:
> As I've said, what you are saying you want is the normal behavior.
>
> To everyone, you must give -detailed- information about exactly what you are
> doing for there to be any hope of someone being able to help you.  In
> particular, provide:
>
> (1) Your complete AndroidManifest.xml
> (2) The exact code you are using to build your Intent objects that you are
> using to start your activities.
> (3) Likewise exactly how you are constructing any PendingIntent being used
> with notifications etc.
> (4) The exact sequence of activities you are seeing started, and what you
> instead expect to have started; supplying the "Starting activity" logs as
> you do the steps can also help a lot.
> (5) It also would tremendously help to supply the output of "adb shell
> dumpsys activity" immediately before you are going to get in to the problem
> state, along with the code you are executing to get in to the problem state,
> and also the "Starting activity" log statement at the point where the
> problematic activity launch happens.
>
>
>
> On Fri, Apr 3, 2009 at 11:05 PM, Lovell <hodayath...@gmail.com> wrote:
>
> > I think I have the same question, but I'm going to try to explain it a
> > little better:
>
> > My app has 4 activities on the stack A->B->C->D (top)
>
> > If you press home and re-enter the application, another instance of A
> > is started, so the stack is A->B->C->D->A (top). I know this because
> > when I press BACK, A is popped off and I now see D (instead of going
> > to the Home screen).
>
> > What I want is that when the user re-enters the app, they re-enter on
> > the same activity they were in before (D). How do you do that?
>
> > On Mar 20, 12:05 pm, Dianne Hackborn <hack...@android.com> wrote:
> > > Um, what you are requesting is the normal behavior.  When you tap on an
> > > app's icon in home, it brings the current task of that app to the
> > foreground
> > > if it is already running.
>
> > > And services are singletons so you can only every get a single instance
> > of a
> > > service running.
>
> > > On Tue, Mar 17, 2009 at 2:26 AM, Derek <cram.de...@gmail.com> wrote:
>
> > > > Hi,
>
> > > > Is it possible to re-use all the instances of Activities and Services
> > > > when an application is launched twice. For instance:
> > > > 1/ I start my application APP1. Some activities are launched and a
> > > > service is started.
> > > > 2/ I click "Home" device button
> > > > 3/ I can see the icon the launch again my application APP1
> > > > 4/ I click on it and the APP1 is launched twice
>
> > > > I would like to re-use the existing the instances of Activities and
> > > > Services from the first launch.
> > > > I guess it is related to "SingleTop" or "SingleTask" but it doesn't
> > > > seem to work.
>
> > > > Any suggestion ?
>
> > > --
> > > Dianne Hackborn
> > > Android framework engineer
> > > hack...@android.com
>
> > > Note: please don't send private questions to me, as I don't have time to
> > > provide private support.  All such questions should be posted on public
> > > forums, where I and others can see and answer them.
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com
>
> 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to