Udostępnij za pośrednictwem


AppWidgetProvider.OnRestored(Context, Int32[], Int32[]) Method

Definition

Called in response to the AppWidgetManager#ACTION_APPWIDGET_RESTORED broadcast when instances of this AppWidget provider have been restored from backup.

[Android.Runtime.Register("onRestored", "(Landroid/content/Context;[I[I)V", "GetOnRestored_Landroid_content_Context_arrayIarrayIHandler")]
public virtual void OnRestored (Android.Content.Context? context, int[]? oldWidgetIds, int[]? newWidgetIds);
[<Android.Runtime.Register("onRestored", "(Landroid/content/Context;[I[I)V", "GetOnRestored_Landroid_content_Context_arrayIarrayIHandler")>]
abstract member OnRestored : Android.Content.Context * int[] * int[] -> unit
override this.OnRestored : Android.Content.Context * int[] * int[] -> unit

Parameters

context
Context

context

oldWidgetIds
Int32[]

oldWidgetIds

newWidgetIds
Int32[]

newWidgetIds

Attributes

Remarks

Called in response to the AppWidgetManager#ACTION_APPWIDGET_RESTORED broadcast when instances of this AppWidget provider have been restored from backup. If your provider maintains any persistent data about its widget instances, override this method to remap the old AppWidgetIds to the new values and update any other app state that may be relevant.

This callback will be followed immediately by a call to #onUpdate so your provider can immediately generate new RemoteViews suitable for its newly-restored set of instances.

In addition, you should set AppWidgetManager#OPTION_APPWIDGET_RESTORE_COMPLETED to true indicate if a widget has been restored successfully from the provider's side.

{

Java documentation for android.appwidget.AppWidgetProvider.onRestored(android.content.Context, int[], int[]).

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