Whenever a new Activity is created onCreate
is called. Followed by onStart
. And onStart
is called again when activity is back on to the screen. I know this fundamentals. But, what is the actual difference between when you launch the activity.
I mean to say, when you click on some object on current activity, you start a new activity by startActivity()
method with an intent of new activity. Now onCreate()
will be called of the second activity and then the onStart()
. When will be the activity visible to the user? After onCreate
or after onStart
? If it is visible after onCreate
and before onStart
, and I do some of the operations in onStart()
, then it will reduce the lag between the user clicking on an object and the screen popping up on screen.
If I move some of the data bindings to onStart will it interfere with the default Activity transitions on lollipop and above (I am not sure about this)?
Is it a good idea to move some of the code to onStart
to reduce a lag between click and new activity shown on user's screen? If yes, what kind of code can be safely moved to onStart
? Like data bindings, database queries, etc. ?
Any guidance will be much appreciated.