Aracılığıyla paylaş


ISharedPreferencesEditor.Commit Method

Definition

Commit your preferences changes back from this Editor to the SharedPreferences object it is editing.

[Android.Runtime.Register("commit", "()Z", "GetCommitHandler:Android.Content.ISharedPreferencesEditorInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public bool Commit ();
[<Android.Runtime.Register("commit", "()Z", "GetCommitHandler:Android.Content.ISharedPreferencesEditorInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member Commit : unit -> bool

Returns

Returns true if the new values were successfully written to persistent storage.

Attributes

Remarks

Commit your preferences changes back from this Editor to the SharedPreferences object it is editing. This atomically performs the requested modifications, replacing whatever is currently in the SharedPreferences.

Note that when two editors are modifying preferences at the same time, the last one to call commit wins.

If you don't care about the return value and you're using this from your application's main thread, consider using #apply instead.

Java documentation for android.content.SharedPreferences.Editor.commit().

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