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. Android and Data Call

Hello everybody.
Is there any way to place data call (CSD) with android?

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

2. Integrating libupnp to Android

Hello Developers,
 I am compiling libupnp with the android for that I placed libupnp in
the external folder of the Android source and placed Android.mk files
in the respective directories but I ended up with some compilation
errors.

The question is I have to modify some of the files in libupnp to
integrate with android or to modify any files in Android source or
above steps will be sufficient for doing the same.

Below are the compilation errors when I am following the above steps.

external/libupnp/upnp/src/../../threadutil/inc/ithread.h:153: warning:
type defaults to 'int' in declaration of 'pthread_rwlockattr_t'
external/libupnp/upnp/src/../../threadutil/inc/ithread.h:153: warning:
'ithread_rwlockattr_t' attribute directive ignored
external/libupnp/upnp/src/../../threadutil/inc/ithread.h:164: warning:
type defaults to 'int' in declaration of 'pthread_rwlock_t'
external/libupnp/upnp/src/../../threadutil/inc/ithread.h:164: warning:
'ithread_rwlock_t' attribute directive ignored
In file included from external/libupnp/upnp/src/ssdp/ssdp_device.c:42:
external/libupnp/upnp/src/inc/upnpapi.h:97: error: expected '=', ',',
';', 'asm' or '__attribute__' before 'GlobalHndRWLock'
external/libupnp/upnp/src/ssdp/ssdp_device.c: In function
'ssdp_handle_device_request':
external/libupnp/upnp/src/ssdp/ssdp_device.c:143: warning: implicit
declaration of function 'pthread_rwlock_wrlock'
external/libupnp/upnp/src/ssdp/ssdp_device.c:143: error:
'GlobalHndRWLock' undeclared (first use in this function)
external/libupnp/upnp/src/ssdp/ssdp_device.c:143: error: (Each
undeclared identifier is reported only once
external/libupnp/upnp/src/ssdp/ssdp_device.c:143: error: for each
function it appears in.)
external/libupnp/upnp/src/ssdp/ssdp_device.c:146: warning: implicit
declaration of function 'pthread_rwlock_unlock'
make: *** [out/target/product/generic/obj/SHARED_LIBRARIES/
libupnp_intermediates/ssdp/ssdp_device.o] Error 1



Thanks in advance
Regards
Aravind

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

3. Widget home screen position

4. cupcake and Bluetooth status

5. XML Layout Specification

6. Displaying stored images

7. I'm not able to receive more than two GPS position. The application hangs.