Should I be sure that if any of my application component is started (onCreate for Activity/Service, onReceived for BroadcastReceiver, etc) then my application instance of Application class already exists?
I have static field "instance" in my Application class
public class MyApplication extends Application {
private static MyApplication instance;
@Override
public void onCreate() {
instance = this;
super.onCreate();
}
public MyApplication getInstance(){
return instance;
}
Of course this class is registered in manifest. I wonder if usage of static instance field is safe and will always return me proper value. I didn't use content providers before, but will it work for content providers too?