WritablePreferences

Subinterface of ReadablePreferences that, in contrast to EditablePreferences, can directly modify preferences since it also inherits PreferencesEditor.

Functions

Link copied to clipboard
abstract fun clear()

Mark in the editor to remove all values from the preferences.

Link copied to clipboard
abstract operator fun contains(key: String): Boolean

Checks whether the preferences contains a preference.

Link copied to clipboard
abstract operator fun get(key: String): String?

Retrieve a String value from the preferences.

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

Retrieve a Boolean value from the preferences.

Link copied to clipboard
open fun getBooleanOrDefault(key: String, defaultValue: Boolean): Boolean

Retrieve a Boolean value from the preferences, providing default value as a fallback.

Link copied to clipboard
open fun getBooleanOrElse(key: String, defaultValue: () -> Boolean): Boolean

Retrieve a Boolean value from the preferences, calling default value getter as a fallback.

Link copied to clipboard
abstract fun getByte(key: String): Byte?

Retrieve a Byte value from the preferences.

Link copied to clipboard
open fun getByteOrDefault(key: String, defaultValue: Byte): Byte

Retrieve a Byte value from the preferences, providing default value as a fallback.

Link copied to clipboard
open fun getByteOrElse(key: String, defaultValue: () -> Byte): Byte

Retrieve a Byte value from the preferences, calling default value getter as a fallback.

Link copied to clipboard
abstract fun getDouble(key: String): Double?

Retrieve a Double value from the preferences.

Link copied to clipboard
open fun getDoubleOrDefault(key: String, defaultValue: Double): Double

Retrieve a Double value from the preferences, providing default value as a fallback.

Link copied to clipboard
open fun getDoubleOrElse(key: String, defaultValue: () -> Double): Double

Retrieve a Double value from the preferences, calling default value getter as a fallback.

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

Retrieve a Float value from the preferences.

Link copied to clipboard
open fun getFloatOrDefault(key: String, defaultValue: Float): Float

Retrieve a Float value from the preferences, providing default value as a fallback.

Link copied to clipboard
open fun getFloatOrElse(key: String, defaultValue: () -> Float): Float

Retrieve a Float value from the preferences, calling default value getter as a fallback.

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

Retrieve an Int value from the preferences.

Link copied to clipboard
open fun getIntOrDefault(key: String, defaultValue: Int): Int

Retrieve an Int value from the preferences, providing default value as a fallback.

Link copied to clipboard
open fun getIntOrElse(key: String, defaultValue: () -> Int): Int

Retrieve an Int value from the preferences, calling default value getter as a fallback.

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

Retrieve a Long value from the preferences.

Link copied to clipboard
open fun getLongOrDefault(key: String, defaultValue: Long): Long

Retrieve a Long value from the preferences, providing default value as a fallback.

Link copied to clipboard
open fun getLongOrElse(key: String, defaultValue: () -> Long): Long

Retrieve a Long value from the preferences, calling default value getter as a fallback.

Link copied to clipboard
open fun getOrDefault(key: String, defaultValue: String?): String?

Retrieve a String value from the preferences, providing default value as a fallback.

Link copied to clipboard
open fun getOrElse(key: String, defaultValue: () -> String?): String?

Retrieve a String value from the preferences, calling default value getter as a fallback.

Link copied to clipboard
abstract fun getShort(key: String): Short?

Retrieve a Short value from the preferences.

Link copied to clipboard
open fun getShortOrDefault(key: String, defaultValue: Short): Short

Retrieve a Short value from the preferences, providing default value as a fallback.

Link copied to clipboard
open fun getShortOrElse(key: String, defaultValue: () -> Short): Short

Retrieve a Short value from the preferences, calling default value getter as a fallback.

Link copied to clipboard
abstract fun remove(key: String)

Mark in the editor that a preference value should be removed.

Link copied to clipboard
abstract fun save()

Commit your preferences changes back from PreferencesEditor to the ReadablePreferences object it is editing. This atomically performs the requested modifications, replacing whatever is currently in the ReadablePreferences.

Link copied to clipboard
abstract operator fun set(key: String, value: Boolean)

Set a Boolean value in the preferences editor.

abstract operator fun set(key: String, value: Byte)

Set a Byte value in the preferences editor.

abstract operator fun set(key: String, value: Double)

Set a Double value in the preferences editor.

abstract operator fun set(key: String, value: Float)

Set a Float value in the preferences editor.

abstract operator fun set(key: String, value: Int)

Set a Int value in the preferences editor.

abstract operator fun set(key: String, value: Long)

Set a Long value in the preferences editor.

abstract operator fun set(key: String, value: Short)

Set a Short value in the preferences editor.

abstract operator fun set(key: String, value: String?)

Set a String value in the preferences editor.