Sdílet prostřednictvím


AppWidgetManager.ActionAppwidgetBind Field

Definition

Activity action to launch from your AppWidgetHost activity when you want to bind an AppWidget to display and bindAppWidgetIdIfAllowed returns false.

[Android.Runtime.Register("ACTION_APPWIDGET_BIND")]
public const string ActionAppwidgetBind;
[<Android.Runtime.Register("ACTION_APPWIDGET_BIND")>]
val mutable ActionAppwidgetBind : string

Field Value

Attributes

Remarks

Activity action to launch from your AppWidgetHost activity when you want to bind an AppWidget to display and bindAppWidgetIdIfAllowed returns false.

You must supply the following extras: <table> <tr> <td>#EXTRA_APPWIDGET_ID</td> <td>A newly allocated appWidgetId, which will be bound to the AppWidget provider you provide.</td> </tr> <tr> <td>#EXTRA_APPWIDGET_PROVIDER</td> <td>The BroadcastReceiver that will be the AppWidget provider for this AppWidget. </td> </tr> <tr> <td>#EXTRA_APPWIDGET_PROVIDER_PROFILE</td> <td>An optional handle to a user profile under which runs the provider for this AppWidget. </td> </tr> </table>

The system will respond with an onActivityResult call with the following extras in the intent: <table> <tr> <td>#EXTRA_APPWIDGET_ID</td> <td>The appWidgetId that you supplied in the original intent.</td> </tr> </table>

When you receive the result from the AppWidget bind activity, if the resultCode is android.app.Activity#RESULT_OK, the AppWidget has been bound. You should then check the AppWidgetProviderInfo for the returned AppWidget, and if it has one, launch its configuration activity. If android.app.Activity#RESULT_CANCELED is returned, you should delete the appWidgetId.

Java documentation for android.appwidget.AppWidgetManager.ACTION_APPWIDGET_BIND.

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

See also