Freigeben über


Preference.PreferenceDataStore Property

Definition

Returns PreferenceDataStore used by this Preference. -or- Sets a PreferenceDataStore to be used by this Preference instead of using android.content.SharedPreferences.

public virtual Android.Preferences.IPreferenceDataStore? PreferenceDataStore { [Android.Runtime.Register("getPreferenceDataStore", "()Landroid/preference/PreferenceDataStore;", "GetGetPreferenceDataStoreHandler", ApiSince=26)] get; [Android.Runtime.Register("setPreferenceDataStore", "(Landroid/preference/PreferenceDataStore;)V", "GetSetPreferenceDataStore_Landroid_preference_PreferenceDataStore_Handler", ApiSince=26)] set; }
[<get: Android.Runtime.Register("getPreferenceDataStore", "()Landroid/preference/PreferenceDataStore;", "GetGetPreferenceDataStoreHandler", ApiSince=26)>]
[<set: Android.Runtime.Register("setPreferenceDataStore", "(Landroid/preference/PreferenceDataStore;)V", "GetSetPreferenceDataStore_Landroid_preference_PreferenceDataStore_Handler", ApiSince=26)>]
member this.PreferenceDataStore : Android.Preferences.IPreferenceDataStore with get, set

Property Value

The PreferenceDataStore used by this Preference or null if none.

Attributes

Remarks

Property getter documentation:

Returns PreferenceDataStore used by this Preference. Returns null if android.content.SharedPreferences is used instead.

By default preferences always use android.content.SharedPreferences. To make this preference to use the PreferenceDataStore you need to assign your implementation to the Preference itself via #setPreferenceDataStore(PreferenceDataStore) or to its PreferenceManager via PreferenceManager#setPreferenceDataStore(PreferenceDataStore).

Java documentation for android.preference.Preference.getPreferenceDataStore().

Property setter documentation:

Sets a PreferenceDataStore to be used by this Preference instead of using android.content.SharedPreferences.

The data store will remain assigned even if the Preference is moved around the preference hierarchy. It will also override a data store propagated from the PreferenceManager that owns this Preference.

Java documentation for android.preference.Preference.setPreferenceDataStore(android.preference.PreferenceDataStore).

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.

Applies to