Preference.SharedPreferences Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns the SharedPreferences
where this Preference can read its
value(s).
public virtual Android.Content.ISharedPreferences? SharedPreferences { [Android.Runtime.Register("getSharedPreferences", "()Landroid/content/SharedPreferences;", "GetGetSharedPreferencesHandler")] get; }
[<get: Android.Runtime.Register("getSharedPreferences", "()Landroid/content/SharedPreferences;", "GetGetSharedPreferencesHandler")>]
member this.SharedPreferences : Android.Content.ISharedPreferences
Property Value
the SharedPreferences
where this Preference reads its value(s). If
this preference isn't attached to a Preference hierarchy or if
a PreferenceDataStore
has been set, this method returns null
.
- Attributes
Remarks
Returns the SharedPreferences
where this Preference can read its value(s). Usually, it's easier to use one of the helper read methods: #getPersistedBoolean(boolean)
, #getPersistedFloat(float)
, #getPersistedInt(int)
, #getPersistedLong(long)
, #getPersistedString(String)
. To save values, see #getEditor()
.
In some cases, writes to the #getEditor()
will not be committed right away and hence not show up in the returned SharedPreferences
, this is intended behavior to improve performance.
Java documentation for android.preference.Preference.getSharedPreferences()
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.