Live Wall纸张力量关闭

时间:2012-09-14 15:20:14

标签: android live-wallpaper

单击“设置”按钮时,我的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> 

main.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" />

的manifest.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>

错误

  

09-14 20:36:53.491:E / AndroidRuntime(542):java.lang.IllegalStateException:无法执行活动的方法   09-14 20:36:53.491:E / AndroidRuntime(542):在android.view.View $ 1.onClick(View.java:2031)   09-14 20:36:53.491:E / AndroidRuntime(542):在android.view.View.performClick(View.java:2364)   09-14 20:36:53.491:E / AndroidRuntime(542):在android.view.View.onTouchEvent(View.java:4179)   09-14 20:36:53.491:E / AndroidRuntime(542):在android.widget.TextView.onTouchEvent(TextView.java:6541)   09-14 20:36:53.491:E / AndroidRuntime(542):在android.view.View.dispatchTouchEvent(View.java:3709)   09-14 20:36:53.491:E / AndroidRuntime(542):在android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)   09-14 20:36:53.491:E / AndroidRuntime(542):在android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)   09-14 20:36:53.491:E / AndroidRuntime(542):在android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)   09-14 20:36:53.491:E / AndroidRuntime(542):at com.android.internal.policy.impl.PhoneWindow $ DecorView.superDispatchTouchEvent(PhoneWindow.java:1659)   09-14 20:36:53.491:E / AndroidRuntime(542):at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107)   09-14 20:36:53.491:E / AndroidRuntime(542):at com.android.wallpaper.livepicker.LiveWallpaperPreview.dispatchTouchEvent(LiveWallpaperPreview.java:199)   09-14 20:36:53.491:E / AndroidRuntime(542):at com.android.internal.policy.impl.PhoneWindow $ DecorView.dispatchTouchEvent(PhoneWindow.java:1643)   09-14 20:36:53.491:E / AndroidRuntime(542):在android.view.ViewRoot.handleMessage(ViewRoot.java:1691)   09-14 20:36:53.491:E / AndroidRuntime(542):在android.os.Handler.dispatchMessage(Handler.java:99)   09-14 20:36:53.491:E / AndroidRuntime(542):在android.os.Looper.loop(Looper.java:123)   09-14 20:36:53.491:E / AndroidRuntime(542):在android.app.ActivityThread.main(ActivityThread.java:4363)   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):at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:860)   09-14 20:36:53.491:E / AndroidRuntime(542):at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)   09-14 20:36:53.491:E / AndroidRuntime(542):at dalvik.system.NativeStart.main(Native Method)   09-14 20:36:53.491:E / AndroidRuntime(542):引起:java.lang.reflect.InvocationTargetException   09-14 20:36:53.491:E / AndroidRuntime(542):at 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.Instrumentation.checkStartActivityResult(Instrumentation.java:1404)   09-14 20:36:53.491:E / AndroidRuntime(542):在android.app.Instrumentation.execStartActivity(Instrumentation.java:1378)   09-14 20:36:53.491:E / AndroidRuntime(542):在android.app.Activity.startActivityForResult(Activity.java:2749)   09-14 20:36:53.491:E / AndroidRuntime(542):在android.app.Activity.startActivity(Activity.java:2855)   09-14 20:36:53.491:E / AndroidRuntime(542):... 24更多

1 个答案:

答案 0 :(得分:1)

main.xml

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

应阅读;

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