Hello,

I'm having issues with activities and instances.

My app consists of 2 activities, let's call them A, and B. A is the
root activity.

When lauchMode of A is "standard" (the default), I have the following
issue :

I run the app for the first time. A is shown. A starts B with
startActivityFOrResults. B is shown.

Now, if I press the HOME key, then I long press HOME, then I select my
app, my task is successfully brought to the frontm and B is still
shown. This is what you would expect.

BUT,

if instead of long pressing the HOME key I go to the launcher, and
select my app, it is not brought the front, instead it is a new
instance of it.

I want to avoid multiple instances, I want to have only one instance
at a time.

Therefore I set the launchMode of A to "singleTask".

In that case, the running instance is always brought to the front as I
wanted, but the "state" of my app is not maintained : A is always
brought to the front, B is closed by the system. The same happens if I
long press the HOME key, or if I run the app again in the launcher. If
B was the top activity while in foreground, it is finished when
brought back, and A is shown.

So I tried "alwaysRetainTaskState" but it didn't change a thing.

How should I do ?

What did I do wrong ?


Thanks,

Florent


-- 
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