onPreferenceChange

abstract fun onPreferenceChange(@NonNull preference: Preference, newValue: Any): Boolean(source)

Called when a preference has been changed by the user. This is called before the state of the preference is about to be updated and before the state is persisted.

Return

true to update the state of the preference with the new value

Parameters

preference

The changed preference

newValue

The new value of the preference