Skip to content

Most visited

Recently visited

navigation
Added in API level 1

SharedPreferences.OnSharedPreferenceChangeListener

public static interface SharedPreferences.OnSharedPreferenceChangeListener

android.content.SharedPreferences.OnSharedPreferenceChangeListener


Interface definition for a callback to be invoked when a shared preference is changed.

Summary

Public methods

abstract void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key)

Called when a shared preference is changed, added, or removed.

Public methods

onSharedPreferenceChanged

Added in API level 1
void onSharedPreferenceChanged (SharedPreferences sharedPreferences, 
                String key)

Called when a shared preference is changed, added, or removed. This may be called even if a preference is set to its existing value.

This callback will be run on your main thread.

Parameters
sharedPreferences SharedPreferences: The SharedPreferences that received the change.
key String: The key of the preference that was changed, added, or removed.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.