Search code examples
javaeclipsesettingslive-wallpaper

live wallpaper-settings button is not working


okay, this is my very first application which i am working on, everything works fine until i wanted to add a settings button to my live wallpaper, the problem is, when i simply hit "settings" it comes with this message of "live wallpaper picker has stopped". here's my code

Android manifest

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
   package="com.Live.zaki"
  android:versionCode="1"
   android:versionName="1.0" >

   <uses-sdk
    android:minSdkVersion="10"
    android:targetSdkVersion="16" />

   <application
     android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.example.ui.MainActivity"
        android:configChanges="orientation|keyboardHidden|screenSize"
        android:exported="true"
        android:label="@string/app_name"
        android:theme="@style/FullscreenTheme" >
         />


        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    android:label="@string/appName"
    android:icon="@drawable/icon">


    <service
        android:name="com.Live.zaki.CustomWallpaper"
        android:label="@string/appName"
        android:permission="android.permission.BIND_WALLPAPER" >
        <intent-filter>
            <action android:name="android.service.wallpaper.WallpaperService" />
        </intent-filter>

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

    <activity
        android:name="com.example.ui.SecondActivity"
        android:label="Home" >
    </activity>
    <activity
      android:name=".PrefsActivity"
    android:theme="@android:style/Theme.Black.NoTitleBar" >
    </activity>
    </application>

     </manifest>

wallpaper.xml

<wallpaper xmlns:android="http://schemas.android.com/apk/res/android" 
android:thumbnail="@drawable/icon"
android:description="@string/appDescription"
android:settingsActivity="com.Live.zaki.PrefsActivity"
/>

prefs.xml

     <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory 
    android:title="@string/general_lwp_settings">

    <CheckBoxPreference
        android:key="lwp_o_scroll_lock_key"
        android:summary="@string/lwp_o_scroll_lock_summary"
        android:title="@string/lwp_o_scroll_lock_title"
        android:defaultValue="false" />
  <CheckBoxPreference
        android:key="lwp_auto_animation_key"
        android:summary="@string/lwp_auto_animation_summary"
        android:title="@string/lwp_auto_animation_title"
        android:defaultValue="false" />
   </PreferenceCategory>

PrefsActivity.java

public class PrefsActivity extends PreferenceActivity{@Override
protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 addPreferencesFromResource(com.Live.zaki.R.xml.prefs);
 }
 }

i haven't yet configured any preference logic on my main livewallpaper.java code, i just want that settings menu to popup "two checkbox in my case". Is this even possible ?? if anyone could help me, that would great !! tips, tutorials anything !! here's my application results without settings,

https://drive.google.com/file/d/0B44QwXQHh5irNFRnYkhzdDhPM00/edit?usp=sharing


Solution

  • buddy add exported flag in setting activity and set it true android:exported="true"