Last active
August 29, 2015 14:08
-
-
Save yagopv/b5942027339e064cb7e0 to your computer and use it in GitHub Desktop.
Singleton Helper for Android
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 class SingletonHelper { | |
private static SingletonHelper instance; | |
private static Context mContext = null; | |
public static SingletonHelper getInstance(Context context) | |
{ | |
if (instance == null) { | |
instance = new SingletonHelper(context); | |
} else { | |
mContext = context; | |
} | |
return instance; | |
} | |
/** | |
* ctor | |
* @param context | |
*/ | |
private SingletonHelper(Context context) { | |
mContext = context; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment