Professional Documents
Culture Documents
The activity lifecycle is the set of states an activity can be in during its entire lifetime,
from the time it's created to when it's destroyed and the system reclaims its resources.
As the user interacts with your app and other apps on the device, activities move into
different states.
A task is a collection of activities that users interact with when performing a certain job.
The activities are arranged in a Stack called Back Stack. The Stack has LIFO structure
and stores the activities in the order of their opening. The Activities in the Stack are
never rearranged. The navigation of the back stack is done with the help of the Back
button.
3. What are the activity states as depicted in the Activity Life Cycle?
▪ Activity Launched
▪ Activity Running
▪ App Process Killed
▪ Activity Shut Down
4. What are the methods involved in the Activity Life Cycle? Explain the typical
workflow of each method.
When a user launches an app, let’s say YouTube to watch a video, onCreate() is called
then onStart() followed by onResume() where the user is now interacting with the
application such as watching a video, this means that the activity is running. After
watching, the user decides to go to Facebook, now the onPause() is called when the
user clicks the home button. The user looks for Facebook and selects the app then the
onStop() method is called to stop the activity of YouTube, when Facebook launches,
the onCreate(), onStart(), and onResume() methods are called.
After using Facebook the user decides to go back to YouTube by pressing the back
button, the methods onPause(), onStop(), and onDestroy() is called. When the user
navigates back to YouTube, the methods onRestart(), onStart() and onResume() is
called, the screen visible to the user is the same screen that he/she left when
navigating to Facebook.