Activity in Android is a building blocks of Android . It is a screen to which user interact with.
Every Activity in android has lifecycle like
It is created,
started,
paused,
stopped,
resumed,
and
destroyed.
These different states of a screen are known as Activity Lifecycle.
In other words we can say Activity is a class pre-written in Java or Kotlin Lanaguage.
In Java follwoing are the Activity functions
onCreate() – It is called when the activity is first created
onStart() – It is called just after it’s creation or by restart method after onStop(). Here Activity start becoming visible to user
onPause() – It is called when Activity content is not visible because user resume previous activity
onResume() – It is called when Activity is visible to user and user can interact with it
onStop() – It is called when activity is not visible to user because some other activity takes place of it
onRestart() – It is called when user comes on screen or resume the activity which was stopped
onDestroy(): – Any activity is known as in destroyed state when it’s not in background