但我很困惑为什么清单中有两个几乎相同的接收器标签。有人可以解释原因吗?
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mamlambo.imageswidget"
android:versionCode="1"
android:versionName="1.0">
<application
android:icon="@drawable/icon"
android:label="@string/app_name"
android:debuggable="true">
<activity
android:name=".ImagesWidgetConfiguration"
android:label="@string/app_name">
<intent-filter>
<action
android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action
android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
</intent-filter>
</activity>
<receiver
android:name="ImagesWidgetProvider">
<intent-filter>
<action
android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/imageswidget_info" />
</receiver>
<receiver
android:name="ImagesWidgetProvider">
<intent-filter>
<action
android:name="android.appwidget.action.APPWIDGET_UPDATE" />
<data android:scheme="images_widget" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/imageswidget_info" />
</receiver>
</application>
<uses-sdk
android:minSdkVersion="3" />
</manifest>
答案 0 :(得分:0)
可能是您的正确代码:
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mamlambo.imageswidget"
android:versionCode="1"
android:versionName="1.0">
<application
android:icon="@drawable/icon"
android:label="@string/app_name"
android:debuggable="true">
<activity
android:name=".ImagesWidgetConfiguration"
android:label="@string/app_name">
<intent-filter>
<action
android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action
android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
</intent-filter>
</activity>
<receiver
android:name="ImagesWidgetProvider">
<intent-filter>
<action
android:name="android.appwidget.action.APPWIDGET_UPDATE" />
<data android:scheme="images_widget" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/imageswidget_info" />
</receiver>
</application>
<uses-sdk
android:minSdkVersion="3" />
</manifest>
它会奏效。希望