Skip to content

Instantly share code, notes, and snippets.

@shikto1
Last active January 11, 2020 13:04
Show Gist options
  • Select an option

  • Save shikto1/9a645252537faee4343faefebec98d90 to your computer and use it in GitHub Desktop.

Select an option

Save shikto1/9a645252537faee4343faefebec98d90 to your computer and use it in GitHub Desktop.
public class SingletonManager {
private static SingletonManager mManager = null;
public synchronized static SingletonManager getInstance(Context context) {
if (mManager == null) {
// Here i am using application context to avoid memory leak...
mManager = new SingletonManager(context.getApplicationContext());
}
return mManager;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment