Sharedpreference
It is a system that allows to access and store, persistently, values referenced by a key.
Access to the system is obtained through the methods Context#getSharedPreferences()
or Activity#getPreferences()
, that return an object that implements the interface Sharedpreferences.
A possible use is to store values of the state of the application, at the time the user abandoned it, so that this state is recovered when he returns to it.
OnSharedPreferenceChangeListener.
Interface to be implemented by a callback to be invoked when a Sharedpreference is changed. callback must be registered using the method registerOnSharedPreferenceChangeListener()
.
Preference
It’s a system that lets you 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 type of value, to be used as views in a Preferenceactivity or a 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. callback is associated with Preference via the method setOnPreferenceChangeListener()
.
References
Has a post in So-En about.
– Marconi