PreferenceEditorFacade

Provides safe access to shared preferences read/write operations.

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
fun clear(): Boolean

Clears all preferences from the shared preferences.

Link copied to clipboard

Commits changes made during editing to the shared preferences.

Link copied to clipboard
fun getBoolean(key: String?, defValue: Boolean): Boolean

Retrieves a boolean value from the shared preferences.

Link copied to clipboard
fun getFloat(key: String?, defValue: Float): Float

Retrieves a float value from the shared preferences.

Link copied to clipboard
fun getInt(key: String?, defValue: Int): Int

Retrieves an int value from the shared preferences.

Link copied to clipboard
fun getLong(key: String?, defValue: Long): Long

Retrieves a long value from the shared preferences.

Link copied to clipboard
fun getString(key: String?, defValue: String?): String?

Retrieves a String value from the shared preferences.

Link copied to clipboard
fun getStringSet(key: String, defValues: Set<String>? = null): Set<String>?

Retrieves a set of String values from the shared preferences.

Link copied to clipboard
fun hasKey(key: String?): Boolean

Checks if the shared preferences contain a specific key.

Link copied to clipboard
fun putBoolean(key: String?, value: Boolean): Boolean

Sets a boolean value in the shared preferences.

Link copied to clipboard
fun putFloat(key: String?, value: Float): Boolean

Sets a float value in the shared preferences.

Link copied to clipboard
fun putInt(key: String?, value: Int): Boolean

Sets an int value in the shared preferences.

Link copied to clipboard
fun putLong(key: String?, value: Long): Boolean

Sets a long value in the shared preferences.

Link copied to clipboard
fun putString(key: String?, value: String?): Boolean

Sets a String value in the shared preferences.

Link copied to clipboard
fun putStringSet(key: String, values: Set<String>?): Boolean

Sets a set of String values in the shared preferences.

Link copied to clipboard
fun remove(key: String?): Boolean

Removes a preference from the shared preferences.

Link copied to clipboard

Begins editing the shared preferences. Changes are not committed until finishEditing is called.