public interface

Preference.OnPreferenceChangeListener

 androidx.preference.Preference.OnPreferenceChangeListener

Overview

Interface definition for a callback to be invoked when the value of this Preference has been changed by the user and is about to be set and/or persisted. This gives the client a chance to prevent setting and/or persisting the value.

Summary

Methods
public booleanonPreferenceChange(Preference preference, java.lang.Object newValue)

Called when a preference has been changed by the user.

Methods

public boolean onPreferenceChange(Preference preference, java.lang.Object newValue)

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.

Parameters:

preference: The changed preference
newValue: The new value of the preference

Returns:

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