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

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


Only the first time.

When Activity is started and application is not loaded, then both onCreate() methods will be called.

But for subsequent starts of Activity, the onCreate() of application will not be called.


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().


Note that if any service is defined to run in other process e.g. with android:process= then Application's onCreate() will be called again for that process.

For example see Android Application class method onCreate being called multiple times