Last active
January 11, 2020 13:22
-
-
Save shikto1/c549869a6c8bc7689be55591158f5541 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 SingletonSampleClass { | |
| private Context mContext; | |
| private static SingletonSampleClass instance = null; | |
| private SingletonSampleClass(Context context) { | |
| this.mContext = mContext; | |
| } | |
| public synchronized static SingletonSampleClass getInstance(Context mContext) { | |
| if (instance == null) instance = new SingletonSampleClass(mContext); | |
| return instance; | |
| } | |
| public void onDestroy() { | |
| if(mContext != null) { | |
| mContext = null; | |
| } | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment