Design + Code an Android App from Scratch
This video demonstrates how the Activity lifecycle methods are called by the Android system. When the app starts, onCreate, onStart, onResume are called which together constitute the Activity creation cycle. onCreate is called once per Activity creation and you can initialise Views and objects inside this method. When you move away from the Activity onPause and onStop are called. If you press back or rotate the screen the Activity is first destroyed which involves calling onPause, onStop, onDestroy and the Activity is created once again with the creation cycle. The onSaveInstanceState is called when the values of the relevant objects inside the activity is saved prior to destroying it. The onRestoreInstanceState is called giving the developer a chance to reload values into those objects whose state was saved in the onSaveInstanceState after the Activity was built from scratch.