-
public class KVUserPreferencesStorageUserPreferences implementation of key/value Storage
-
-
Constructor Summary
Constructors Constructor Description KVUserPreferencesStorage(Context context)Constructor
-
Method Summary
Modifier and Type Method Description booleanpersist(@NonNull() String key, @Nullable() String value)Save value into the Shared Preferences Stringget(@NonNull() String key)Get a value from the Shared Preferences Stringget(@NonNull() String key, @Nullable() String defaultValue)Get a value from the Shared Preferences booleancontains(@NonNull() String key)Check if a value is in the Shared Preferences voidremove(@NonNull() String key)Remove value from the Shared Preferences voidclear()Clear all values from the Shared Preferences -
-
Constructor Detail
-
KVUserPreferencesStorage
KVUserPreferencesStorage(Context context)
Constructor- Parameters:
context- used to get shared prefs
-
-
Method Detail
-
persist
@AnyThread() boolean persist(@NonNull() String key, @Nullable() String value)
Save value into the Shared Preferences
- Parameters:
key- The name of the preference to add.value- The value of the preference to modify.
-
get
@Nullable()@AnyThread() String get(@NonNull() String key)
Get a value from the Shared Preferences
- Parameters:
key- The name of the preference to get.
-
get
@Nullable()@AnyThread() String get(@NonNull() String key, @Nullable() String defaultValue)
Get a value from the Shared Preferences
- Parameters:
key- The name of the preference to get.defaultValue- The value to fallback if operation failed or key doesn't exist.
-
contains
@AnyThread() boolean contains(@NonNull() String key)
Check if a value is in the Shared Preferences
- Parameters:
key- The name of the preference to get.
-
remove
@AnyThread() void remove(@NonNull() String key)
Remove value from the Shared Preferences
- Parameters:
key- The name of the preference to remove.
-
-
-
-