How to create a settings activity for Android Live Wallpaper

Finesse picture Finesse · Dec 28, 2011 · Viewed 11.2k times · Source

How to create a settings activity in live wallpaper like this?

Example Picture

I've built settings activity with only a simple text and faced some problems. The first problem is that I can't use layout XML file for this activity. The second: I can't set the directory to system icon (drawable/ic_menu_more) when I try to build that activity programmly. Also I will need do use SeekBar.

I will be very pleased, if you help me =)

Answer

Mohit Verma picture Mohit Verma · Jan 16, 2012

For using system icon:

<service android:name="com.livewallpaper.warm.LiveWallpaper"
            android:label="@string/app_name"
            android:icon="@drawable/ic_menu_more">

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

        </service>

In XML-livewallpaper.xml:

<?xml version="1.0" encoding="utf-8"?>
<wallpaper xmlns:android="http://schemas.android.com/apk/res/android"
    android:settingsActivity="com.livewallpaper.warm.LiveWallpaperSettings"
    android:thumbnail="@drawable/ic_menu_more"/>