8

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
    This section in [Application Fundamentals](https://developer.android.com/guide/components/fundamentals.html#Components) describes how the system creates the Application object, then the Application creates components such as Activities and Services. – Sam Feb 14 '13 at 18:00

2 Answers2

8

will this implementation always be created before the initial Activity

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

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • 7
    [Documentation](https://developer.android.com/reference/android/app/Application.html#onCreate%28%29) to support this, in case some people don't believe your word alone. – Sam Feb 14 '13 at 18:35
3

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.