When does Application's onCreate() method get called?

后端 未结 3 1464
傲寒
傲寒 2020-12-01 04:50

In my Android application, I have a DefaultApplication class which extends android.app.Application, and in its onCreate() I bind some

3条回答
  •  青春惊慌失措
    2020-12-01 05:29

    You can find an official answer when onCreate is called here.

    Called when the application is starting, before any activity, service, or receiver objects (excluding content providers) have been created. Implementations should be as quick as possible (for example using lazy initialization of state) since the time spent in this function directly impacts the performance of starting the first activity, service, or receiver in a process. If you override this method, be sure to call super.onCreate().

提交回复
热议问题