Is the Application instance always created before

2019-04-24 15:09发布

问题:

In Android, you can provide your own implementation of the Application class by extending it and declaring the name in the Manifest.

My question is, will this implementation always be created before the initial Activity, or can Activities be launched before the Application instance has had time to be created?

回答1:

will this implementation always be created before the initial Activity

Yes. It is one of the first objects instantiated in your process.



回答2:

Yes Application class is the first class which is inititated in any android application...

And thus if any class extends the application class that class will be initiated first.