public interface SharedPreferencesFacade
SharedPreferences and to simplify putting and
obtaining of values for such preferences implementation.| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(String key)
Checks whether the
SharedPreferences hidden behind this facade contain value for the
specified key or not. |
boolean |
getBoolean(String key,
boolean defValue)
Retrieves the boolean value for the specified key from
SharedPreferences
hidden behind this facade. |
float |
getFloat(String key,
float defValue)
Retrieves the float value for the specified key from
SharedPreferences
hidden behind this facade. |
int |
getInt(String key,
int defValue)
Retrieves the integer value for the specified key from
SharedPreferences
hidden behind this facade. |
long |
getLong(String key,
long defValue)
Retrieves the long value for the specified key from
SharedPreferences
hidden behind this facade. |
String |
getString(String key,
String defValue)
Retrieves the string value for the specified key from
SharedPreferences
hidden behind this facade. |
Set<String> |
getStringSet(String key,
Set<String> defValues)
Retrieves the set of string values for the specified key from
SharedPreferences
hidden behind this facade. |
boolean |
putBoolean(String key,
boolean value)
Puts the given boolean value for the specified key into
SharedPreferences
hidden behind this facade. |
boolean |
putFloat(String key,
float value)
Puts the given float value for the specified key into
SharedPreferences
hidden behind this facade. |
boolean |
putInt(String key,
int value)
Puts the given integer value for the specified key into
SharedPreferences
hidden behind this facade. |
boolean |
putLong(String key,
long value)
Puts the given long value for the specified key into
SharedPreferences
hidden behind this facade. |
boolean |
putString(String key,
String value)
Puts the given string value for the specified key into
SharedPreferences
hidden behind this facade. |
boolean |
putStringSet(String key,
Set<String> values)
Puts the given set of string values for the specified key into
SharedPreferences
hidden behind this facade. |
void |
registerOnSharedPreferenceChangeListener(android.content.SharedPreferences.OnSharedPreferenceChangeListener listener)
Registers a listener in order to receive a callback whenever a value of preference persisted
within the
SharedPreferences hidden behind this facade changes. |
boolean |
remove(String key)
Removes a value for the specified key from the
SharedPreferences hidden
behind this facade. |
int |
removeAll()
Removes all values from the
SharedPreferences hidden behind this facade. |
void |
unregisterOnSharedPreferenceChangeListener(android.content.SharedPreferences.OnSharedPreferenceChangeListener listener)
Un-registers a previously registered listener in order to not receive further any callbacks
about preference changes.
|
void registerOnSharedPreferenceChangeListener(android.content.SharedPreferences.OnSharedPreferenceChangeListener listener)
SharedPreferences hidden behind this facade changes.listener - The desired listener to be registered.unregisterOnSharedPreferenceChangeListener(SharedPreferences.OnSharedPreferenceChangeListener),
SharedPreferences.registerOnSharedPreferenceChangeListener(SharedPreferences.OnSharedPreferenceChangeListener)void unregisterOnSharedPreferenceChangeListener(android.content.SharedPreferences.OnSharedPreferenceChangeListener listener)
listener - The desired listener to be un-registered.registerOnSharedPreferenceChangeListener(SharedPreferences.OnSharedPreferenceChangeListener),
SharedPreferences.unregisterOnSharedPreferenceChangeListener(SharedPreferences.OnSharedPreferenceChangeListener)boolean contains(String key)
SharedPreferences hidden behind this facade contain value for the
specified key or not.key - The key of which value's presence to check.True if there is value contained for the specified key, false otherwise.remove(String),
SharedPreferences.contains(String)boolean putString(String key, String value)
SharedPreferences
hidden behind this facade.key - The key for which to put the value into preferences.value - The desired value to put into preferences.True if put has been successful, false otherwise.SharedPreferences.edit(),
SharedPreferences.Editor#putString(String, String)String getString(String key, String defValue)
SharedPreferences
hidden behind this facade.key - The key for which to retrieve its associated value.defValue - Default value to be returned in case when there is no value persisted for
the specified key.contains(String),
SharedPreferences.getString(String, String)boolean putStringSet(String key, Set<String> values)
SharedPreferences
hidden behind this facade.key - The key for which to put the values into preferences.values - The desired values to put into preferences.True if put has been successful, false otherwise.SharedPreferences.edit(),
SharedPreferences.Editor#putStringSet(String, Set)Set<String> getStringSet(String key, Set<String> defValues)
SharedPreferences
hidden behind this facade.key - The key for which to retrieve its associated values.defValues - Default values to be returned in case when there are no values persisted for
the specified key.contains(String),
SharedPreferences.getStringSet(String, Set)boolean putInt(String key, int value)
SharedPreferences
hidden behind this facade.key - The key for which to put the value into preferences.value - The desired value to put into preferences.True if put has been successful, false otherwise.SharedPreferences.edit(),
SharedPreferences.Editor#putInt(String, int)int getInt(String key, int defValue)
SharedPreferences
hidden behind this facade.key - The key for which to retrieve its associated value.defValue - Default value to be returned in case when there is no value persisted for
the specified key.contains(String),
SharedPreferences.getInt(String, int)boolean putFloat(String key, float value)
SharedPreferences
hidden behind this facade.key - The key for which to put the value into preferences.value - The desired value to put into preferences.True if put has been successful, false otherwise.SharedPreferences.edit(),
SharedPreferences.Editor#putFloat(String, float)float getFloat(String key, float defValue)
SharedPreferences
hidden behind this facade.key - The key for which to retrieve its associated value.defValue - Default value to be returned in case when there is no value persisted for
the specified key.contains(String),
SharedPreferences.getFloat(String, float)boolean putLong(String key, long value)
SharedPreferences
hidden behind this facade.key - The key for which to put the value into preferences.value - The desired value to put into preferences.True if put has been successful, false otherwise.SharedPreferences.edit(),
SharedPreferences.Editor#putLong(String, long)long getLong(String key, long defValue)
SharedPreferences
hidden behind this facade.key - The key for which to retrieve its associated value.defValue - Default value to be returned in case when there is no value persisted for
the specified key.contains(String),
SharedPreferences.getLong(String, long)boolean putBoolean(String key, boolean value)
SharedPreferences
hidden behind this facade.key - The key for which to put the value into preferences.value - The desired value to put into preferences.True if put has been successful, false otherwise.SharedPreferences.edit(),
SharedPreferences.Editor#putBoolean(String, boolean)boolean getBoolean(String key, boolean defValue)
SharedPreferences
hidden behind this facade.key - The key for which to retrieve its associated value.defValue - Default value to be returned in case when there is no value persisted for
the specified key.contains(String),
SharedPreferences.getBoolean(String, boolean)boolean remove(String key)
SharedPreferences hidden
behind this facade.key - The key for which to remove its associated value.True if removal has been successful, false otherwise.removeAll(),
contains(String),
SharedPreferences.edit(),
SharedPreferences.Editor#remove(String)int removeAll()
SharedPreferences hidden behind this facade.0
if there are no values persisted.remove(String),
SharedPreferences.getAll(),
SharedPreferences.edit(),
SharedPreferences.Editor#remove(String)