0

单击“设置”按钮时,我的 Live wall 应用程序强制关闭。

wall_setting.xml

    <?xml version="1.0" encoding="utf-8"?>
    <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">

<ListPreference 
        android:key="time_interval"
        android:title="@string/app_name"
        android:summary="something"
        android:defaultValue="3000" 
        android:entries="@array/updateInterval"
        android:entryValues="@array/updateIntervalValues"
    />

</PreferenceScreen> 

主要的.xml

<?xml version="1.0" encoding="utf-8"?>
<wallpaper xmlns:android="http://schemas.android.com/apk/res/android"
android:thumbnail="@drawable/ic_launcher"
android:settingsActivity="com.zacharia.lunar.WallService"
android:description="@string/wall_desc" />

清单.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.zacharia.lunar"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="7"
    android:targetSdkVersion="15" />
<uses-feature 
    android:name="android.software.live_wallpaper"
    android:required="true"></uses-feature>

   <application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >

    <service 
       android:name="com.zacharia.lunar.WallService"
       android:enabled="true"
       android:permission="android.permission.BIND_WALLPAPER">
        <intent-filter>
<action android:name="android.service.wallpaper.WallpaperService"></action>
        </intent-filter>
        <meta-data 
            android:name="android.service.wallpaper"
            android:resource="@xml/main"></meta-data>
    </service>
    <activity
        android:name="com.zacharia.lunar.SettingActivity"
        android:label="@string/title_activity_main" 
        android:theme="@android:style/Theme.Light.WallpaperSettings"
        android:exported="true">

    </activity>
</application>

</manifest>

错误

InvocationTargetException 09-14 20:36:53.491: E/AndroidRuntime(542): 在 com.android.wallpaper.livepicker.LiveWallpaperPreview.configureLiveWallpaper(LiveWallpaperPreview.java:113) 09-14 20:36:53.491: E/AndroidRuntime(542 ): at java.lang.reflect.Method.invokeNative(Native Method) 09-14 20:36:53.491: E/AndroidRuntime(542): at java.lang.reflect.Method.invoke(Method.java:521) 09 -14 20:36:53.491: E/AndroidRuntime(542): 在 android.view.View$1.onClick(View.java:2026) 09-14 20:36:53.491: E/AndroidRuntime(542): ... 20 更多 09-14 20:36:53.491: E/AndroidRuntime(542): 由: android.content.ActivityNotFoundException: 无法找到显式活动类 {com.zacharia.lunar/com.zacharia.lunar.WallService}; 您是否在 AndroidManifest.xml 中声明了此活动?09-14 20:36:53.491:E/AndroidRuntime(542):在 android.app。

4

1 回答 1

1

main.xml

    android:settingsActivity="com.zacharia.lunar.WallService"

应该读;

    android:settingsActivity="com.zacharia.lunar.SettingActivity"
于 2012-09-14T15:26:26.307 回答