Explain Android Activity Lifecycle


An activity is born and destroyed so it is called lifecycle of an activity.There are six methods in the lifecycle of an activity.Whenever an activity is launched the onCreate method of that activity is fired and all that written inside the onCreate method is executed.Next the onStart and onResume methods will be executed. After that the activity will come to front and you can interact with the activity. Now when another activity is launched from the current activity the current activity will go behind the newly launched activity so its onPause method will be called after that onStop method will be called. And when the user navigates to the old activity again then onRestart method will be called. Otherwise if the activity is destroyed by the system then onDestroy method will be called and activity will be shutdown.

Share on Google Plus

About Vaishakh

I am a Java and Android developer and a science enthusiast.I Like to explain complex things in simple language so anybody even without a graduation in computer science or Electronics can understand the concepts easily.

0 comments:

Post a Comment