SharedPreferencesView

public final class SharedPreferencesView


Read-only wrapper around SharedPreferences. This will be passed in to your migration.

Summary

Public methods

final boolean

Checks whether the preferences contains a preference.

final @NonNull Map<@NonNull StringObject>

Retrieve all values from the preferences that are in the specified keySet.

final boolean
getBoolean(String key, boolean defValue)

Retrieves a boolean value from the preferences.

final float
getFloat(String key, float defValue)

Retrieves a float value from the preferences.

final int
getInt(String key, int defValue)

Retrieves a int value from the preferences.

final long
getLong(String key, long defValue)

Retrieves a long value from the preferences.

final String
getString(String key, String defValue)

Retrieves a string value from the preferences.

final Set<@NonNull String>
getStringSet(String key, Set<String> defValues)

Retrieves a string set value from the preferences.

Public methods

contains

public final boolean contains(String key)

Checks whether the preferences contains a preference.

Parameters
String key

the name of the preference to check

Throws
kotlin.IllegalArgumentException

if key wasn't specified as part of this migration

getAll

public final @NonNull Map<@NonNull StringObjectgetAll()

Retrieve all values from the preferences that are in the specified keySet.

getBoolean

public final boolean getBoolean(String key, boolean defValue)

Retrieves a boolean value from the preferences.

Parameters
String key

the name of the preference to retrieve

boolean defValue

value to return if this preference does not exist

Throws
kotlin.IllegalArgumentException