Request for comment on Activity flow design

by Gavin Bong » Tue, 24 Jun 2008 16:06:59 GMT

Sponsored Links
 I have a need to intersperse the flow between one Activity to another
with an intermediate Activity.

Let's call the intermediate activity INTERMEDIATE.

So imagine my application having a normal activity flow like this:

A -> B -> C -> D

Now putting the intermediary activity into the flow, we get:


When the user presses the BACK button starting from D, it will go
directly to C.
i.e. the INTERMEDIATE activity only appears in the forward direction.

Basically INTERMEDIATE will transition between foreground & background
many times
throughout the lifetime of the app.

A summary of my requirements:

1) The INTERMEDIATE activity should NOT die unless the initial launch
activity A exits.
    i.e. I only have an "exit" menu item in A.

2) I need to be able to change the contents displayed by INTERMEDIATE
during a transition.
   i.e. From A -> B, I will need the properties of INTERMEDIATE: (2.1)
the displayed content. (2.2) the "next" activity to progress to
(activity B). This applies to the other forward transitions.

My idea:

3) Store the "states" in a service. And in INTERMEDIATE's onResume() I
can query the service
for both (2.1) and (2.2) and change it accordingly.
4) I still don't know which of the launch modes to use for
Based on the docs; it's between singleTask and singleInstance. However
I don't understand the concept of "Tasks" as described in the doc:


Only allow one instance of this activity to ever be running. This
activity gets a unique task with only itself running in it; if it is
ever launched again with the same Intent, then that task will be
brought forward and its onNewIntent(Intent) method called. If this
activity tries to start a new activity, that new activity will be
launched in a separate task.

Any help would be much appreciated.



Request for comment on Activity flow design

by Mark Murphy » Tue, 24 Jun 2008 20:42:54 GMT

 > Any help would be much appreciated.

Just because you want multiple disparate views does not mean you need 
multiple disparate activities.

For example, you could use ViewFlipper to hold A, B, C, D, and 
INTERMEDIATE as views, and flip between them as needed based on your 
business requirements.

The only absolute need for separate activities is if they need to be 
separate entry points from outside your application (e.g., the classic 

Mark Murphy (a Commons Guy) 
Warescription: All titles, revisions, & ebook formats, just $35/year


Sponsored Links

Request for comment on Activity flow design

by hackbod » Thu, 26 Jun 2008 04:59:35 GMT

 Don't use singleTask or singleInstance, because that will cause your
overall activity flow to be broken up into separate tasks for each
activity where this intermediate goes.

There really isn't a way to do exactly what you want.


Request for comment on Activity flow design

by [EMAIL PROTECTED] » Thu, 26 Jun 2008 06:53:17 GMT

 Why can't INTERMEDIATE be a part of each preceeding activity and
optionally excecuted based on state information? Or be the parent of
B, C, and D visibly present only when desired?


Other Threads

1. API for arbitrary tags in an image file (location etc)?

I noticed that Picassa can read location from tags in an image file.  The
camera in the G1 can update a tag for location.  Is this available in  an
so that we can do the same in our apps?



2. API for getting URL associated with a Geopoint

Does anyone know of what the API is for getting URL's associated with a
given Geopoint?



3. Filesystem on G1

4. Adding views at runtime.

5. Tips for Orientation

6. maps package sources

7. Where are the predefined gmail contact groups ?