currently, in my App I have the following class:
public class MyApp extends Application {
private static Context context;
public void onCreate(){
super.onCreate();
MyApp.context = getApplicationContext();
}
public static Context getContext() {
return MyApp.context;
}
}
I use this to have Context in classes that are neither Activities nor Fragment. It's there any difference between use the context stored on this class and use and activity as context? It is a good practice to have this class or should I provide an activity as context to any class who needs it?
Thanks.