Widgets are implemented as Intent Receivers with Intent Filters that catch broadcast Intents, which request widget updates using the AppWidget.ACTION_APPWIDGET_UPDATE, deleted, enabled, and DiSABLED actions. You can create your widget by extending the intentReceiver class directly and interpreting those broadcast Intents by overriding the onReceive method.
The AppWidgetProvider class provides a simplified alternative by encapsulating the Intent processing and presenting you with event handlers for the update, delete, enable, and disable events.
Listing 10-3 shows a simple widget implementation that extends AppWidgetProvider and overrides the onUpdate method:
Was this article helpful?
Quick start guide to skyrocket your offline and online business success with mobile apps. If you know anything about mobile devices, you’ve probably heard that famous phrase coined by one of the mobile device’s most prolific creators proclaiming that there’s an app for pretty much everything.