0

There is an app that sets 960x800 image as phone's wallpaper. I found that many developers suggest this resolution. However, an image is still getting cropped. I use a basic code for setting the wallpaper

WallpaperManager wallpaperManager = WallpaperManager.getInstance(getApplicationContext());
wallpaperManager.setResource(R.drawable.some_image);

I need an advice on what to do next:

  1. Make one wallpaper for each screen resolution?
  2. Programmatically resize image to a current screen resolution?
  3. I am using the wrong code and there is a better one

If the second choice is the right solution, how should I do it? I'd appreciate some links if there's too much coding involved.

Thanks

sandalone
  • 41,141
  • 63
  • 222
  • 338

1 Answers1

1

Use a 9-patch image for backgrounds, wallpapers are the same I think. Google docs on Android recommend this. This image is stretchable. A good link explaining it is here.

omermuhammed
  • 7,365
  • 4
  • 27
  • 40
  • I am aware of 9.png, but I did not know I can use it for bg. If it works, I will mark your reply as answer. – sandalone May 25 '11 at 18:39
  • It did not solve the problem for wallpaper. It is still stretched. Maybe I made 9-patch in a non-correct way, but it did not work. – sandalone May 26 '11 at 17:25
  • It should, look at here (http://www.pocketmagic.net/?p=1882) about how to save and use 9-patch images. We use it and it works. Also google for using 9-patch as backgrounds. It is a fairly common solution. – omermuhammed May 26 '11 at 18:11
  • I have to be more precise. I do not need it for background of the `View`. Were you referring to this? I need it as a wallpaper on the mobile desktop (just like live wallpaper, but a regular wallpaper) – sandalone May 26 '11 at 18:26
  • Now that is different story :) I dont know how that works on desktops. Sorry, I am out of my league there. Good luck on this though. – omermuhammed May 26 '11 at 18:33
  • I made a 9.png image with the lowest resolution and I think it works this way. :) – sandalone May 29 '11 at 14:19