How do I correctly manage the activity stack in this instance?

by Tom Gibara » Fri, 29 May 2009 05:00:13 GMT


Sponsored Links
 I'm working to finish a small application, but I'm having problems seeing
what combination of activity attributes and intent flags I need to achieve
my intended application design. Trying my best not to describe the app in
minute detail, here's the basic operation (I've supplied screenshots in the
hope it makes sense easily):
Users have a garden which contains flowers (GardenActivity).

 http://www.tomgibara.com/images/daisy/garden/hut_screen.jpg 

They can tap on a garden to see details of flowers (FlowerActivity)

 http://www.tomgibara.com/images/daisy/garden/flower_screen.jpg 

When flowers are fully grown a notification provided, tapping on the
notification displays the garden containing the flower.

 http://www.tomgibara.com/images/daisy/garden/notify_screen.jpg 

Users can also use the GardenActivity as a picker to choose flowers to
"exhibit" (ConfigureActivity)

 http://www.tomgibara.com/images/daisy/garden/planting_screen.jpg 

I want the app to operate so that if the user already has a GardenActivity
somewhere in the stack (whether it's at the top, or underneath a
FlowerActivity) the notification will alert the user by bringing that
activity to the front (clearing any FlowerActivity that may be above it).
I've tried using the FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TOP
combination (without changing any activity launch modes) on the
notification's pending intent, but it still launches a new GardenActivity,
even if one is already available.

I've also tried using android:launchMode="singleTask" on GardenActivity. The
notifications then seem to work correctly, but it prevents GardenActivity
from returning any result back to ConfigureActivity.

Any help appreciated, I'm stumped by this at the moment.

Tom.

--~--~---------~--~----~------------~-------~--~----~



How do I correctly manage the activity stack in this instance?

by Mike Hearn » Fri, 29 May 2009 05:24:56 GMT


 Are you sure having a notification re-order the backstack like that is
a good idea? My understanding is:

I open garden A
I open garden B   (pressing back gets me to A)
I open garden C
I put the phone to sleep. At some point a notification appears. I
press it.
The notification opens garden A.
Now I expect pressing back to return me to garden C, then B, then A
again. Not C, then B, then the home screen or whatever.





--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Other Threads

1. Changes not appearing in Android

Hello, I'm a brand new Android developer. I have it all running great
and was able to run Hello Android fine.

Nut I want to make changes to it, and they are not appearing. I edited
the main.xml file to change the welcome text, and I edited the .java
file to also change the text but for some reason it still shows the
original HelloAndroid.

How do I recompile it? What am I missing???

Thanks!

--~--~---------~--~----~------------~-------~--~----~

2. how to create welcome screen 4 my Game

Hi,
i want to make game like all games in mobile when we start the then a
welcome screen opens first which ask "press any key to continue"...i
want to create like this...i have already created the game already
only that welcome page is missing....
can anyone telll me plzzz
thanks
Byee:)
--~--~---------~--~----~------------~-------~--~----~

3. set the height of row displayed in alertdialoq.builder

4. Seting the Height of row of the AlerDialog.Builder from java file

5. set the height of row of alett dialoq

6. to change the height of rows that are displayed in listDialoque .

7. About textfile