撰写widget
并在我尝试为widget
添加设置活动后,我收到错误"未找到启动器活动!"
这是我的AndroidManifest.xml
:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.persianweather"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<receiver android:name="com.example.persianweather.Main" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<!-- This specifies the widget provider info -->
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/widget" />
</receiver>
<activity
android:name="com.example.persianweather.SettingActivity"
android:label="@string/title_activity_setting" >
<intent-filter >
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
</intent-filter>
</activity>
</application>
答案 0 :(得分:0)
No Launcher activity found!
表示您未提及启动应用程序的任何活动。尝试在清单中添加这些行。要在启动时启动的活动的intent过滤器中指定这些MAIN和LAUNCHER,如:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
注意:单个intent-filter标记中的多个操作标记也会导致相同的错误。
答案 1 :(得分:0)
将您的SettingActivity设为启动器活动,只有这样您才能继续进行,
<activity
android:name="com.example.persianweather.SettingActivity"
android:label="@string/title_activity_setting" >
<intent-filter >
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>