Sdílet prostřednictvím


Context.MoveSharedPreferencesFrom(Context, String) Method

Definition

Move an existing shared preferences file from the given source storage context to this context.

[Android.Runtime.Register("moveSharedPreferencesFrom", "(Landroid/content/Context;Ljava/lang/String;)Z", "GetMoveSharedPreferencesFrom_Landroid_content_Context_Ljava_lang_String_Handler", ApiSince=24)]
public abstract 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)>]
abstract member 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

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.

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

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