ANDROID PROGRAMMING

What is activity life cycle

 What is activity life cycle

An activity goes through various stages which is known as activity life cycle.
As a user navigates through out of and back to your app. The activity instance in your application transition through various stages in their life cycle. The activity class provides a number of callbacks that allow the activity to know that a state has changed that the system is creating, resuming or stopping an activity or destroying the process in which the activity resides within the callback methods you can declare how your activity behaves when the user leaves and returns the activity.


Activity lifecycle concepts:-

To navigate transitions between stages of the activity life cycle the activity class provides a core set of callbacks these are as :-

on Create() This is the first callback and called when the activity is first created.
on Start() This callback is called when the activity becomes visible to the user.
on Resume() This is called when the user starts interacting with the application.
on Pause() The paused activity does not receive user input and cannot execute any code and called when the current activity is being paused and the previous activity is being resumed.
on Stop() This callback is called when the activity is no longer visible.
on Destroy() This callback is called before the activity is destroyed by the system.
on Restart() This callback is called when the activity restarts after stopping it.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button