philo
philo

Reputation: 3690

What happens between Application#onCreate and Activity#onCreate?

I'm seeing 200ms or more latency between MyApplication#onCreate and MyActivity#onCreate. Does anything significant happen in that interval?

Upvotes: 3

Views: 181

Answers (3)

Madhav
Madhav

Reputation: 351

Application onCreate() : Called only once when application start. if you kill app then open app. it will call again.

Activity onCreate() : Called then the activity is created. it you re-open activity it will call again but Application onCreate will call only once within application.

Upvotes: 0

user8257042
user8257042

Reputation:

Application onCreate() :

Called before the first components of the application starts

Activity onCreate() :

Called then the activity is created. Used to initialize the activity, for example create the user interface.

Upvotes: 0

Neel Mehta
Neel Mehta

Reputation: 106

Based on the documentation of Application#onCreate (link), it is called before any Activity/Service/Receiver objects are created.

This means that after Application#onCreate the Activity (MyActivity in your case) is instantiated and only then can Activity#onCreate be called.

EDIT: Based on your implementation, even the call to super.onCreate() in MyActivity would add to the time interval.

Upvotes: 1

Related Questions