SharedPreference
It is a system that allows you to access and store, persistently, values referenced by a key.
Access to the system is achieved through Context#getSharedPreferences()
or Activity#getPreferences()
methods, which return an object that implements the SharedPreferences .
One possible use is to store application state values at the time the user left the application so that it can be retrieved when the user returns to the state.
OnSharedPreferenceChangeListener .
Interface to be implemented by a callback to be invoked when a SharedPreference is changed. The callback must be registered using the registerOnSharedPreferenceChangeListener()
method.
Preference
It is a system that allows you to unify how applications allow users to configure application characteristics and behaviors.
To maintain an interface consistent with the user experience with other Android applications, subclasses of Preference , one for each value type, to be used as views in a PreferenceActivity or PreferenceFragment.
The Preference class uses SharedPreference to persist its values.
OnPreferenceChangeListener .
Interface to be implemented by a callback to be invoked when this Preference is changed. The callback is associated with Preference using the setOnPreferenceChangeListener()
method.
References