Skip to content

Instantly share code, notes, and snippets.

View EffyCoder's full-sized avatar

Shantanoo Harmalkar EffyCoder

View GitHub Profile
@EffyCoder
EffyCoder / SharedPreferencesSingletonEnumKeyTemplate.java
Created August 29, 2017 10:19 — forked from alphamu/SharedPreferencesSingletonEnumKeyTemplate.java
A SharedPreferences singleton that can be used to centralise and simplify reading and writing of SharedPerferences in your Android app. There are 2 versions, one that uses static String for Keys and an other that uses enums. Which one you use comes down to your preference, enums I feel provides better control when you have multiple programmers w…
#if (${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
import android.content.Context;
import android.content.SharedPreferences;
/*
* A Singleton for managing your SharedPreferences.
*
* You should make sure to change the SETTINGS_NAME to what you want
* and choose the operating made that suits your needs, the default is