Activity Life Cycle is part of Android Studio. Activity lifecycle works in a different method. There are seven methods of activity lifecycle. Let's discuss all methods of the Android activity lifecycle.
- OnCreate()
- OnStart()
- OnResume()
- OnRestart()
- OnPause()
- OnStop()
- OnDestroy()
1.OnCreate(): It is called when the activity is first created. This method is used to create a view, binding view in activity.
2.OnStart(): It is called when the activity is visible to the user. This method is called after the onCreate() method.
3.OnResume(): This method calls after the onStart() method . Also called when activity background and move other activity.
4.OnRestart(): This method is also called when the application is in the background and the application resumes.
5.OnPause(): This method is also called when the application is Pause() or moved to the background app.
6.OnStop(): This method is also called when the application is OnStop() moved to the background app or the application is killed.
7. OnDestroy(): This method is also called when the mobile application is OnDestroy() moved to the application killed.
Happy Coding!