Possible Duplicate:
Android Activity Life Cycle - difference between onPause() and OnStop()
I was wondering - what is the difference between onCreate()
and onStart()
methods?
I think that onStart()
is a redundant method. onCreate()
will ALWAYS be called (At least in my last two projects).
Can any one explain the difference?
onCreate()
method gets called when activity gets created, and its called only once in whole Activity life cycle. where asonStart()
is called when activity is stopped... I mean it has gone to background and itsonStop()
method is called by the os.onStart()
may be called multiple times in Activity life cycle.More details hereTake a look on life cycle of Activity
Where
Called when the activity is first created. 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. Always followed by onStart().
Called when the activity is becoming visible to the user. Followed by onResume() if the activity comes to the foreground, or onStop() if it becomes hidden.
And you can write your simple class to take a look when these methods call
Hope this will clear your confusion.
And take a look here for details.
Lifecycle Methods in Details is a very good example and demo application, which is a very good article to understand the life cycle.