From my point of view, the application in Android is singleton (correct me if I am wrong), and we always have only one instance of the application.
So, from this point of view, is it inconvenient to keep the application context in my Application class? Could this lead to a massive memory leak?
Here is an example:
public class MyApp extends Application { private static Context appContext = null;
The reason for this is access to global classes, such as the PreferencesManager, which basically have static methods that always need context. Therefore, instead of passing it each time (or even storing it in an instance, which may be bad), I thought about keeping the application context. What disadvantages do I not see?
source share