15

I built my first Android app.

It is a Live Wallpaper designed for 2.2.

When I press and hold the screen, select Wallpapers and then select Live Wallpapers, my live wallpaper has what looks like a default icon with the name of my live wallpaper overlaid.

How do I set this icon?

My manifest file has an application icon specified as @drawable/icon

Update

I think I need to add some info to this question as it poorly describes my problem (sorry).

  1. I have all the res/drawable-[hml]dpi/ icons. I named them all icon.png.
  2. My manifest file contains <application android:label="@string/app_name" android:icon="@drawable/icon">
  3. I have also tried creating a 48x48 icon in res/drawable/ called icon.png.
  4. I have also tried explicitly adding icons in other manifest tags if they are allowed. eg. service, activity, intent-filter (It should be obvious that I don't know how this manifest file really works, so I was trying anything)
  5. In Manage Applications, the icon is displayed correctly.
  6. When selecting the Live Wallpaper, the icon is not displayed correctly.
  7. mdpi icon is 48x48, ldpi icon is 36x36 and hdpi icon is 72x72
George Freeman
  • 2,260
  • 1
  • 15
  • 22
philcolbourn
  • 4,042
  • 3
  • 28
  • 33

7 Answers7

36

In order to see an icon in the live wallpaper menu, you need to set the android:thumbnail attribute for the applications <Wallpaper> tag. This will normally be found in the XML file corresponding to the class that extends WallpaperService.

Looking at the CubeLiveWallpaper sample application provided with the SDK, we see this tag to be located in cube1.xml and cube2.xml. A modified version below displays the icon thumb.png located in res/drawable and provides a description defined in strings.xml

<wallpaper 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:thumbnail="@drawable/thumb"
    android:description="@string/description"
    android:settingsActivity="com.example.android.livecubes.cube2.CubeWallpaper2Settings"
/>

NOTE: this works regardless of file extension, assuming that the format is a supported type - jpg. png etc

Navierstokes
  • 418
  • 3
  • 7
  • Interesting. My SDK example doesn't match yours. I wonder if I killed it as I was trying to get Eclipse working - I picked this exact example to try first. I also don't have a thumb icon. – philcolbourn Aug 24 '10 at 11:37
  • Thank you. I needed the thumbnail attribute and an icon. Thank you. – philcolbourn Aug 24 '10 at 11:38
  • Thanks George. I have been using my live wallpaper for nearly a year. Works great. Thank you everyone for helping. – philcolbourn Aug 16 '11 at 13:18
1

You can also change @drawable/icon to @drawable/<youricon>

Falmarri
  • 47,727
  • 41
  • 151
  • 191
  • Is icon the default or does android use the first icon it finds? – philcolbourn Aug 19 '10 at 11:59
  • 1
    icon is just the name of the file in res/drawable/. – Melody Horn Aug 19 '10 at 14:50
  • I just realized SO didn't like my custom pseudo-tag. You can just name it anything you want, and it will match youricon with the name of the drawable in the res/drwable folders. It ignores the filetype so you don't need to include an extension in your xml – Falmarri Aug 19 '10 at 16:38
  • @Falmarri : how we can set live wallpaper as an default wallpaper from application?..have any idea? – CoDe Nov 01 '12 at 09:59
  • @Subh: This question is 2 years old, you should ask a new one. But I'm pretty sure there's no way to set a "live wallpaper" as a background for an individual app. Only the system background. – Falmarri Nov 03 '12 at 05:31
  • @Falmarri thanks for your view..can u suggest any reference regards it? – CoDe Nov 08 '12 at 05:45
1

I've set <application android:icon="@drawable/icon"/> in my AndroidManifest.xml and it's working fine for each icon.png I'm using in the

/res/drawable- :== hdpi | ldpi | mdpi

folders.

Ben Weiss
  • 17,182
  • 6
  • 67
  • 87
0

More info about resolution can be found in this thread.

This section especially:

...The resolution used seems to be a lot larger than the launcher icon resolution, using 48 for medium or 72 for high gives a very blurred image on both the emulator and real devices, leading me to think there is some scaling going on...

Shadow The GPT Wizard
  • 66,030
  • 26
  • 140
  • 208
0

Animated .GIF file is not supported as Application launcher icon. Gif icon wont give you any compluation error but animation wont work.

Rajhrita
  • 105
  • 1
  • 3
  • 11
0

Create your icon and save it in res/drawable/icon.png. You can also use icon.jpg, icon.gif, or icon.bmp.

Melody Horn
  • 778
  • 2
  • 6
  • 22
0

inside the res/drawables directories you will see icon.png. you change this file to be the icon you want. the hdpi are for the devices with high density, like the nexus one, or evo. mdpi is for devices like the myTouch or G1

Ryan Conrad
  • 6,870
  • 2
  • 36
  • 36
  • I have an icon in res/drawable called icon.png. This works when the application is installed, but not when the user selects the live wallpaper. But are you suggesting that I should have different sized icon.png files in res/drawable-Xdpi/ directories? – philcolbourn Aug 19 '10 at 11:58
  • Actually, I already have different sized icon files names icon.png in the drawable- ldpi, mdpi and hdpi directories. – philcolbourn Aug 19 '10 at 12:03