Created
April 10, 2016 16:04
-
-
Save krvajal/7179e0b5b90195c6d295ee4c38ce7134 to your computer and use it in GitHub Desktop.
Simple singleton for getting the Android context available anywhere
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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