When writing an Android app you’re guaranteed to only have one instance of the
android.app.Application class, so it’s safe (and recommended by the Google Android team) to treat it as a singleton. That is, you can safely add a static
getInstance() method to your
Application implementation. Example 2-2 provides an example.
The Application class, or your subclass of the Application class, is instantiated before any other class when the process for your application/package is created.
Share this highlighthttp://www.safaribooksonline.com/a/android-cookbook-2nd/4228897/