What is an activity life cycle

An Activity Life Cycle

An activity is the fundamental building block of an android application.From the start to end an application there are different states that maintain an activity. When an activity change their state the appropriate life cycle event is called the notifying the activity of the implementing state change.

An android application can be launched by an registering an activity. In android most of the application will only have a specific activity as the application entry point. The life cycle is implemented as a collection of  the methods the OS called through out the life cycle of an activity.

An Activity State

There are basically Four activity state during the activity transition.

  1. Active/Running 
    It is considered as a active or running state of an activity. this is the top level of an activity stack.It ha the highest priority in an android application.
  2. Active Paused
    When an application goes to sleep, but still visible and partially hidden by a new, non-full-sized or transparent activity, the activity is considered paused.They maintain all state and member information, and remain attached to the window manager. This is the second highest priority activity in Android and,
  3. Stopped or Backgrounded
    An activities that are fully obscured by another activity are considered stopped or in the background. Stopped activities still try to retain their state as long as possible, but stopped activities are considered to be the lowest priority of the three states.
  4. Restarted
    It is possible for an activity that is anywhere from paused to stopped in the lifecycle to be removed from memory by Android. If the user navigates back to the activity it must be restarted, restored to its previously saved state, and then displayed to the user.





No comments:

Post a Comment