Почему в настройках обоев есть ошибка исключения?

1

Я делаю обои для Android и имею проблемы. Когда я нажимаю кнопку настроек, я вижу:

01-22 11:50:47.579: E/AndroidRuntime(18421): FATAL EXCEPTION: main
01-22 11:50:47.579: E/AndroidRuntime(18421): java.lang.IllegalStateException: Could not execute method of the activity
01-22 11:50:47.579: E/AndroidRuntime(18421):    at android.view.View$1.onClick(View.java:2154)
01-22 11:50:47.579: E/AndroidRuntime(18421):    at android.view.View.performClick(View.java:2538)
...

Мой код: LiveWallpaperSettings.java:

package com.samples;

import android.os.Bundle;
import android.preference.PreferenceActivity;

public class LiveWallpaperSettings extends PreferenceActivity
{
    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        addPreferencesFromResource(R.xml.wallpaper_settings);
    }
}

wallpaper_settings.xml:

<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
        android:title="@string/wallpaper_label">
        <PreferenceCategory android:title="General">
                <CheckBoxPreference
                        android:title="Pref01 title"
                        android:summary="Pref01 summary"
                        android:key="pref01" 
                        android:defaultValue="true"
                />
        </PreferenceCategory>
</PreferenceScreen>

wallpaper.xml:

<?xml version="1.0" encoding="UTF-8"?>
<wallpaper
        xmlns:android="http://schemas.android.com/apk/res/android"  
        android:thumbnail="@drawable/icon"
        android:description="@string/wallpaper_description"
        android:settingsActivity="com.sample.LiveWallpaperSettings"/>

Manifest:

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

    <uses-sdk android:minSdkVersion="7" />
    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" 
        android:permission="android.permission.BIND_WALLPAPER">
        <service 
            android:name=".LiveWallpaperService"
            ...

            <intent-filter>
                ...
            </intent-filter>
            <meta-data 
              android:name="android.service.wallpaper" 
              android:resource="@xml/wallpaper" />
        </service>

        <activity 
            android:label="@string/wallpaper_label"
            android:name=".LiveWallpaperSettings"
            android:theme="@android:style/Theme.Light.WallpaperSettings"
            android:exported="true"
            android:icon="@drawable/icon">
        </activity>
    </application>
</manifest>

LiveWallpaperService не использует никаких предпочтений. Что я забыл написать? Помоги пожалуйста!

Теги:
live-wallpaper

1 ответ

1
Лучший ответ

Имя пакета неверно на wallpaper.xml:

android:settingsActivity="com.sampleS.LiveWallpaperSettings"
  • 0
    Боже ты мой!!! TNX!

Ещё вопросы

Сообщество Overcoder
Наверх
Меню