Activity Life Cycle
Activity Launched -- onCreate() -- onResume() -- onPause() -- onDestroy()
Apart from above methods, start and stop, onRestart methods are also available but it is not much as important as above methods.
Each class in Android must extend Activity class to create an application.When activity gets started the first method onCreate() will be called in that we need to set the content view with the XML layout for UI design components.
Then onResume() method will be called when activity is again invoked i.e. navigate to previously opened activity.
onPause() method will be invoked when the activity gets navigation action, the current activity will be in pause state without doing any performance.
onDestroy() method is used to destroy the current activity.
No comments:
Post a Comment