Android Activity Life Cycle Explanation With Code

Sankar Balan
2 min readJan 24, 2020

What is Activity?

1. Activity is one of the app components.

2. Activity interacts user interface on the mobile view

List out android activity lifecycle:

Every function has some lifecycle structure that follows as use well the same as some procedure life cycle is used in the android activity.

onCreate-When activity launch from this onCreate() method is called.

onStart-After launch the activity onStart() method is called.

onResume-When user interacts with the activity onResume() method is called.

onPause-When new activity comes,when you close the app, etc onPause() method is called.

onStop()-When activity is no longer visible,app killed,app close,etc onStop() method is called.

onRestart()-when the user no longer visible but user return to activity time on restart() method is called.

onDestroy()-when you user exit the app or destroy the app onDestroy() method is called.

This is the simple intro for the activity life cycle in android.

--

--

Sankar Balan
0 Followers

Senior Software Developer, Android developer, Speaker, Technical writer, volunteer