Skip to content

Instantly share code, notes, and snippets.

@krvajal
Created April 10, 2016 16:04
Show Gist options
  • Save krvajal/7179e0b5b90195c6d295ee4c38ce7134 to your computer and use it in GitHub Desktop.
Save krvajal/7179e0b5b90195c6d295ee4c38ce7134 to your computer and use it in GitHub Desktop.
Simple singleton for getting the Android context available anywhere
public final class AndroidContext {
private static Context context;
public static Context getContext() {
return context;
}
public static void setContext(Context context) {
AndroidContext.context = context;
}
private AndroidContext() {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment