edit
inline fun SharedPreferences.edit(commit: Boolean = false, action: SharedPreferences.Editor.() -> Unit)(source)
Allows editing of this preference instance with a call to apply or commit to persist the changes. Default behaviour is apply.
prefs.edit {
putString("key", value)
}
Content copied to clipboard
To commit changes:
prefs.edit(commit = true) {
putString("key", value)
}
Content copied to clipboard