Most visited

Recently visited

Added in API level 1

SharedPreferences.OnSharedPreferenceChangeListener

public static interface SharedPreferences.OnSharedPreferenceChangeListener

android.content.SharedPreferences.OnSharedPreferenceChangeListener


在共享首选项发生更改时调用回调的接口定义。

Summary

Public methods

abstract void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key)

在共享首选项被更改,添加或删除时调用。

Public methods

onSharedPreferenceChanged

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

在共享首选项被更改,添加或删除时调用。 即使首选项设置为其现有值,也可能会调用此选项。

此回调将在您的主线程上运行。

Parameters
sharedPreferences SharedPreferences: The SharedPreferences that received the change.
key String: The key of the preference that was changed, added, or removed.

Hooray!