To access the Context in which it is absent, you can extend the Application class and create a static link to the Context. Thus, you can access it from anywhere in the application:
public class MyApp extends Application { public static Context context; @Override public void onCreate() { super.onCreate(); context = getApplicationContext(); } }
source share