共用方式為


Context.MoveDatabaseFrom(Context, String) Method

Definition

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

[Android.Runtime.Register("moveDatabaseFrom", "(Landroid/content/Context;Ljava/lang/String;)Z", "GetMoveDatabaseFrom_Landroid_content_Context_Ljava_lang_String_Handler", ApiSince=24)]
public abstract bool MoveDatabaseFrom (Android.Content.Context? sourceContext, string? name);
[<Android.Runtime.Register("moveDatabaseFrom", "(Landroid/content/Context;Ljava/lang/String;)Z", "GetMoveDatabaseFrom_Landroid_content_Context_Ljava_lang_String_Handler", ApiSince=24)>]
abstract member MoveDatabaseFrom : Android.Content.Context * string -> bool

Parameters

sourceContext
Context

The source context which contains the existing database to move.

name
String

The name of the database file.

Returns

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

Attributes

Remarks

Move an existing database 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 migrating to device protected storage.

The database must be closed before being moved.

Java documentation for android.content.Context.moveDatabaseFrom(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