When I first starting programming for the Android I was quite confused about the life-cycle of activities. It seemed almost strange how the application started, stopped, and paused without seemingly any logical reasoning. The activity would be destroyed and re-created when the screen was rotated and paused when other applications were started…

I soon learned that having a good grasp on the life-cycle of an activity was critical. Making an efficient application and knowing when to save critical data related to your activities state, let alone restoring your application to a particular state is all a part of the activity life-cycle.

There is a lot of different articles and information available on the internet about the life-cycles of activities. The Google documentation has good information on this as well. But I’m always better at understanding things if I see them for myself.

So I decided that I would write a simple activity that prints out debug statements each time one of the functions of the life-cycle was executed! Then I would be able to see exactly what is happening during each phase and when each function occurs during different situations.
Read the rest of this entry »