Android - Using Application context everywhere?

In an Android app, is there anything wrong with the following approach:

public class MyApp extends android.app.Application { 
 
    private static MyApp instance; 
 
    public MyApp() { 
        instance = this; 
    } 
 
    public static Context getContext() { 
        return instance; 
    } 
 } 
and pass it everywhere (e.g. SQLiteOpenHelper) where context is required (and not leaking of course)?

VIEW COMPLETE THREAD WITH REPLIES

Popular Posts