<receiver android:name=".MusicWidget">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="@layout/widget_setting">
</meta-data>
android:name 后面的是怎么确定的?怎么跟widget对应起来的?
迷茫2017-04-17 15:51:24
There are two types of actions, one is system level action and the other is application custom action. For widgets, to implement widget updates, you must filter and monitor the android.appwidget.action.APPWIDGET_UPDATE action. This is a system-level action defined and managed by AppWidgetManger. The system Framework layer AppWidgetService is responsible for the widget's broadcast update support. , and finally the application layer AppWidgetProvider (derived from BroadcastReceiver) receives this action and processes it.
黄舟2017-04-17 15:51:24
This name needs to specify a Receiver subclass or AppWidgetProvider subclass. When the widget corresponding to the specified AppWidgetProviderInfo in this meta-data is added to the home screen, deleted, or updated by the user, the Receiver specified by this name will receive the widget. to the corresponding broadcast. The broadcast Intent contains the id of the corresponding AppWidget. This id can be used to find the corresponding AppWidget through AppWidgetManager