ContextWrapper.MoveSharedPreferencesFrom(Context, String) Method

Definition

Move an existing shared preferences file from the given source storage context to this context. This is typically used to migrate data between storage locations after an upgrade, such as moving to device protected storage.

[Android.Runtime.Register("moveSharedPreferencesFrom", "(Landroid/content/Context;Ljava/lang/String;)Z", "GetMoveSharedPreferencesFrom_Landroid_content_Context_Ljava_lang_String_Handler", ApiSince=24)]
public override bool MoveSharedPreferencesFrom(Android.Content.Context? sourceContext, string? name);
[<Android.Runtime.Register("moveSharedPreferencesFrom", "(Landroid/content/Context;Ljava/lang/String;)Z", "GetMoveSharedPreferencesFrom_Landroid_content_Context_Ljava_lang_String_Handler", ApiSince=24)>]
override this.MoveSharedPreferencesFrom : Android.Content.Context * string -> bool

Parameters

sourceContext
Context

The source context which contains the existing shared preferences to move.

name
String

The name of the shared preferences file.

Returns

true if the move was successful or if the shared preferences didn't exist in the source context, otherwise false .

Attributes

Remarks

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.

Java documentation for android.content.ContextWrapper.moveSharedPreferencesFrom(android.content.Context, java.lang.String).

Applies to