Hi all,

I've been learning Android.. almost done with my 3rd book now.. have a
pretty good idea of the beginner things like the life cycle, etc. One thing
that kind of perplexes me is the benefits of using multiple activities each
with their own lifecycle events in them. In a normal Swing, or other UI
based app,  you usually have a single class with events to handle create,
start/stop, pause/resume, destroy, etc. From that class you can spawn
threads to do the work, change the UI, etc etc. With Android, it seems that
apps have potentially many activities. Maybe I am doing something wrong, but
each time I open a new activity represented by a new class.. that Activity
"takes over" the event processing of the app. So each and every Activity
class requires all the event methods.. just in case a user happens to hit
the BACK button at one stage of my app over another. I know I can put the
common save/load routines into a base class that extends Activity, and have
all my activites extend it.. which is probably what I will do.. but it seems
strange to me that each dialog, every screen, etc is it's own activity and I
more or less need to duplicate the code to handle pause/resume, start/stop,
etc events for each activity in case it's the one running. If I have a
splash activity that starts the main screen, then the user goes to high
scores, I have to handle the events for pause/resume, etc.. and so forth for
every screen in my game, or app. Is this what most everyone is doing? OR am
I missing the boat on this issue and there is a better way to allow say, a
single Activity to handle the full app lifecycle events from Android, and
spawning other activities ignore all those things.. knowing that the main
app activity handles the issue of saving/restoring data if need be?

Please, enlighten me if I am missing something on this. Seems like a lot of
extra coding to build what seems to be a normal Android app. Again, I
realize I can copy/paste, or subclass Activity and extend my own "common"
Activity.. I am just wondering what many of you are doing out there for this
situation.

Thanks.

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to