How to create a settings activity for Android Live Wallpaper

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

Example Picture

  • Detect inside Android Browser or WebView
  • Highlight selected item inside a RecyclerView
  • How to send a simple email programatically? (exists a simple way to do it?)
  • Get all full visible objects on lListView
  • NoClassDefFoundError with libraries in Android Studio
  • Android - How to upload photo from the SD card to the Facebook wall
  • 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 =)

    Related posts:

    Do I need to uses always the last targetSdkVersion?
    How to run debug app version on a 'debug' Firebase database
    Unable to build: the file dx.jar was not loaded from the SDK folder in my eclipse
    How to speed up Android Studio on a Mac
    Dagger 2 error: dependency “cannot be provided without an @Inject constructor” w...
    How to read output of android process command
  • Augmented Reality Toolkit - Android
  • HAX kernel module is not installed
  • Android 4.2.1, WebView and javascript interface breaks
  • How to use android ndk to access camera
  • Scale factor for xxhdpi android?
  • Performing action after fragment transaction animation is finished
  • 2 Solutions collect form web for “How to create a settings activity for Android Live Wallpaper”

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

    The LiveWallpaper Example on the Android Dev site goes through exactly that:
    http://developer.android.com/resources/samples/CubeLiveWallpaper/index.html

    More specifically:
    http://developer.android.com/resources/samples/CubeLiveWallpaper/src/com/example/android/livecubes/cube2/CubeWallpaper2Settings.html

    In short:

    public class CubeWallpaper2Settings extends PreferenceActivity
    implements SharedPreferences.OnSharedPreferenceChangeListener {
    
    @Override
    protected void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        getPreferenceManager().setSharedPreferencesName(
                CubeWallpaper2.SHARED_PREFS_NAME);
        addPreferencesFromResource(R.xml.cube2_settings);
        getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener(
                this);
    }
    
    @Override
    protected void onResume() {
        super.onResume();
    }
    
    @Override
    protected void onDestroy() {
        getPreferenceManager().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(
                this);
        super.onDestroy();
    }
    
    public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
            String key) {
    }
    }
    
    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.