Use application class as singleton
问题 In Android we often have to use Context classes. When a class or method requires a Context we often use Activites or Services for such arguments. The following code is from a website I found but I do not know if this is good practice and if it is okay to use this solution: public class MyApplication extends Application { private static MyApplication singleton; @Override public void onCreate() { super.onCreate(); singleton = this; } public static MyApplication getInstance() { return singleton;