Computer Science, asked by zahrarida086, 7 months ago

What are the seven lifecycle methods of Android activity and what is their purpose?

Answers

Answered by gauris1897
2

Answer:

Life Cycle Methods and Callbacks

In general, activity lifecycle has seven callback methods:

onCreate()

onStart()

onResume()

onPause()

onStop()

onRestart()

onDestroy()

1. onCreate(): In this state, the activity is created.

2. onStart(): This callback method is called when the activity becomes visible to the user.

3. onResume(): The activity is in the foreground and the user can interact with it.

4. onPause(): Activity is partially obscured by another activity. Another activity that’s in the foreground is semi-transparent.

5. onStop(): The activity is completely hidden and not visible to the user.

6. onRestart(): From the Stopped state, the activity either comes back to interact with the user or the activity is finished running and goes away. If the activity comes back, the system invokes onRestart()

7. onDestroy(): Activity is destroyed and removed from the memory.

Similar questions