On Mon, Aug 16, 2010 at 11:38 PM, David <[email protected]> wrote:
> What advantages of multiple activities am I missing?

1. Android can incrementally reclaim RAM by getting rid of activities
that are not being used, so other applications can run. Your approach
makes that difficult, so unless *you're* going to do all the
management tasks of cleaning up portions of your activity that are not
being used, Android can only reclaim your activity as a whole.

2. Related to #1, it will be easier to introduce memory leaks by
trying to have a single activity stick around for a long period of
time, rather than having lighter activities that come and go. You may
wind up having to utilize techniques like game apps use, to minimize
allocations and garbage collection -- eminently doable, but a pain.

3. State management, for dealing with eviction from memory (e.g.,
orientation change, RAM reclamation) can become more challenging or
more inefficient.

4. You may find many features of Android, like notifications and app
widgets, become progressively more challenging to use when you cannot
simply launch an appropriate activity.

5. Java does not support multiple inheritance, so if you have features
that require separate Android base classes (e.g., preferences and
maps), it is impossible to implement them all in one activity.

I'm sure we can come up with other reasons -- this will hopefully do
for starters.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 3.1 Available!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to