write

fun write(key: String, value: Any, oneTimeOnly: Boolean = false)

Writes a key-value pair to the SharedPreferences.

The value's type should be one of the following: String, Set, Boolean, Float, or Long.

Parameters

key

The key to associate the value with.

value

The value to store under the given key. The value must be one of the supported types.

oneTimeOnly

If true, the value will be saved as one-time only.

See also

Throws

if the value is not one of the supported types.