Aim
Write a program to study the life cycle of android activity.
What is the cycle of activity?
The cycle of activity refers to the completion of an entire activity from beginning, to the middle, to the end.
An Android activity goes through six major life cycle stages or callbacks. These activities are: onCreate(), onStart(), onResume() , onPause() , onStop() , and onDestroy().
Code:
MainActivity.java
activity_main.xml
Output:
Output on Android Studio:
Start App : onCreate >> onStart >> onResume
Home App : onPause >> onStop
Recent App : onStart >> onResume
Close App : onPause >> onStop >> onDestroy
Output on Mobile:


.png)
.png)