1.Activity lifecycle:- we are here look the way Activity represents one screen or one page in your app.
lets say activity start by click on launcher icon.(Activity with intent filter launch will be get launched).
Here is
1.onCreate() :- its get called very first and only one time. In which we set the content view of the activity. It is responsible for creation of activity , its view. Allocation of resources etc.This is where you should do all of your normal static set up: create views, bind data to lists, etc. This method also provides you with a Bundle containing the activity's previously frozen state, if there was one.
2.onStart():-Called when the activity is becoming visible to the user.
3.onResume() will get get called every time the the activity comes in foreground (like viewwillappear in ios).Called when the activity will start interacting with the user. At this point your activity is at the top of the activity stack, with user input going to it.
4.onPause() will be get called every time when the activity goes into background (like viewwilldisappear in ios).Called when the system is about to start resuming a previous activity. This is typically used to commit unsaved changes to persistent data, stop animations and other things that may be consuming CPU, etc. Implementations of this method must be very quick because the next activity will not be resumed until this method returns.
5.onStop() when activity is not visible or say phone call arrives so app goes in background , in this case onStop() gets called. Called when the activity is no longer visible to the user, because another activity has been resumed and is covering this one.
6.onDestroy() when back called on the activity. It can be skipped .The final call you receive before your activity is destroyed.
No comments:
Post a Comment