@Retention(value=CLASS) @Target(value=METHOD) public @interface PreferenceChange
This annotation is intended to be used on methods to receive events defined
by
OnPreferenceChangeListener#onPreferenceChange when the value of a
Preference has been changed by the user
and is about to be set and/or persisted.
The annotation value should be one or several R.string.* fields that refers
to Preference or subclasses of
Preference. If not set, the method name
will be used as the R.string.* field name.
The method MAY have multiple parameter:
Preference parameter to know
which preference was targeted by this eventObject or Set of strings or
Boolean or String to obtain the new value of the
Preference
Example :
@PreferenceChange(R.string.myPref)
void checkedChangedOnMyButton(boolean newValue, Preference preference) {
// Something Here
}
@PreferenceChange
void myPrefPreferenceChanged(Preference preference) {
// Something Here
}
@PreferenceChange({R.string.myPref1, R.string.myPref2})
void preferenceChangeOnMultiplePrefs(Preference preference, String newValue) {
// Something Here
}
@PreferenceChange(R.string.myPref)
void preferenceChangeOnMyPref() {
// Something Here
}
PreferenceClickpublic abstract String[] resName
Copyright © 2010-2015. All Rights Reserved.