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. Is there only 1 version of The Nexus One for all countries?

Are there different versions of the Nexus One depending on the country it is
sold in? The HTC spec sheet says the frequencies depend on the operator, but
I guess the hardware is the same. Does it come with different adapters for
the charger?




2. USB Data Transfer

Hi, I'm a student working on an undergraduate senior design project,
and I've been reading up on your host patch because we are using the
HTC Sprint Hero in our project.  You seem to know a lot about the USB
so I was wondering if you could help me.  We are trying to take in a
serial string of data from a device through USB.  The device sends
data every second starting with a # sign and ending with a $ sign.  I
was wondering if you knew of a way to pole the USB data lines (by
their address or some other command) for the the # sign and then for
the $ sign.  Is this even possible, or is there maybe a better way to
try to accomplish this?


3. Mobile KeyPad support on Omap3evm

4. market android di spica 2.1

5. Bahan review untuk Indosat dan mitra kerjanya dalam pameran Android di Mega Bazaar

6. OnClickListener in my ListView

7. Android Device Seeding Program - Differences in phone for developers?