Here I will discuss the life cycle of an Android Application...
The Life cycle of an Android Application has 4 states and 7 methods.
Lets name them :
The four states :
The seven methods :The Life cycle of an Android Application has 4 states and 7 methods.
Lets name them :
The four states :
- Activity Launched
- Activity Running
- App process killed
- Activity shutdown
- onCreate()
- onStart()
- onRestart()
- onResume()
- onPause()
- onStop()
- onDestroy()
![]() |
Life cycle of Android Activity |
Are you able to see all the 4 methods and the 7 methods .
In the previous post we discussed about Activity class . It lets you connect to the UI (XML) .
The 7 methods are declared in class Activity .
- When the Activity is launched (i.e. you clicked the icon to start the App) the onCreate() method start to execute onCreate() corresponds to main method in Core Java .
- The onCreate() method is followed by onStart() and onResume() . When in onResume() state your first page is displayed on the screen .
- onPause() method is used when you pause an application (when your application runs in background).
- onStop() method is called the you are removing an application from memory (Pressing End for any app in the above screenshot) .
- onDestroy() method is called as soon as onStop() method is called .
- The onDestroy() method removes the application from memory and free the resources of the device .
Stay Tuned with Made In Android
No comments:
Post a Comment