android Component Lifecycles

android Application components have a lifecycle

1. A beginning when Android instantiates them to respond to
intents
2. An end when the instances are destroyed.
3. In between, they may sometimes be active or inactive, or ‐in the
case of activities‐ visible to the user or invisible.

Activty Stack

• Activities in the system y are managed as an activity stack.
• When a new activity is started, it is placed on the top of the
stack and becomes the running activity ‐‐ the previous
activity always remains below it in the stack, and will not
come to the foreground again until the new activity exits.
11
• If the user presses the Back Button the next activity on the
stack moves up and becomes active.
 


Android Life Cycle States

An activity has essentially
three states:
1. It is active or running
2. It is paused or

3. It is stopped .


android life cycle states
android life cycle states






























1. It is active or running when it is in the foreground of the screen
(at the top of the activity stack for the current task).
This is the activity that is the focus for the user's actions.

2. It is paused if it has lost focus but is still visible to the user.
That is, another activity lies on top of it and that new activity either is
transparent or doesn't cover the full screen.
A paused activity is completely alive (it maintains all state and member
information and remains attached to the window manager), but can
killed by the system in extreme low memory situations.
3. It is stopped if it is completely obscured by another activity.
It still retains all state and member information. However, it is no longer
visible to the user so its window is hidden and it will often be killed by
the system when memory is needed elsewhere.


android application lifecycle






1 comments: