public class TuneSharedPrefsDelegate extends Object
Constructor and Description |
---|
TuneSharedPrefsDelegate(Context context,
String name) |
Modifier and Type | Method and Description |
---|---|
void |
clearSharedPreferences()
Removes all keys from shared preferences
|
boolean |
contains(String prefsKey)
Checks if a given key exists in the shared preferences
|
Map<String,?> |
getAll() |
boolean |
getBooleanFromSharedPreferences(String prefsKey)
Retrieves a boolean from SharedPreferences
|
boolean |
getBooleanFromSharedPreferences(String prefsKey,
boolean defaultValue)
Retrieves a boolean from SharedPreferences
|
String |
getStringFromSharedPreferences(String prefsKey)
Retrieves a String from SharedPreferences
|
String |
getStringFromSharedPreferences(String prefsKey,
String defaultValue)
Retrieves a String from SharedPreferences
|
void |
remove(String key) |
void |
saveBooleanToSharedPreferences(String prefsKey,
boolean prefsValue)
Saves a Boolean to SharedPreferences
|
void |
saveToSharedPreferences(String prefsKey,
String prefsValue)
Saves a String to SharedPreferences
|
public void saveToSharedPreferences(String prefsKey, String prefsValue)
prefsKey
- SharedPreferences key to save underprefsValue
- SharedPreferences value to savepublic void saveBooleanToSharedPreferences(String prefsKey, boolean prefsValue)
prefsKey
- SharedPreferences key to save underprefsValue
- SharedPreferences value to savepublic String getStringFromSharedPreferences(String prefsKey)
prefsKey
- SharedPreferences key of the value requestedpublic String getStringFromSharedPreferences(String prefsKey, String defaultValue)
prefsKey
- SharedPreferences key of the value requesteddefaultValue
- Value to return if the key does not existpublic boolean getBooleanFromSharedPreferences(String prefsKey)
prefsKey
- SharedPreferences key of the value requestedpublic boolean getBooleanFromSharedPreferences(String prefsKey, boolean defaultValue)
prefsKey
- SharedPreferences key of the value requesteddefaultValue
- Value to return if the key does not existpublic boolean contains(String prefsKey)
public void clearSharedPreferences()
public void remove(String key)