Lifecycle of Android Activity








An activity is a single, focused thing that the user can do. Almost all activities interact with the user, so the Activity class takes care of creating a window for you in which you can place your UI with setContentView(View). 


Activity is a window that contains the user interface of your application. As there are various states of activity like Running, Paused, Stopped and Killed.
Activity base class contains events that govern the life cycle of an activity.
  • onCreate(): Called when the activity is first created
  • onStart(): Called when the activity becomes visible to the user
  • onResume(): Called when the activity starts interacting with the user
  • onPause(): Called when the current activity is being paused and the previous activity is being resumed
  • onStop(): Called when the activity is no longer visible to the user
  • onDestroy(): Called before the activity is destroyed by the system
  • onRestart(): Called when the activity has been stopped and is restarting again


Comments

Popular posts from this blog

Android Sudoku Game Project With Source Code