How to set an image as wallpaper on different api levels

SDK Version: 

Pretty easy! :)
Use the context’s setWallpaper method.

  1. getApplicationContext().setWallpaper(bitmap)

Don’t forget to add the SET_WALLPAPER permission to your AndroidManifest.xml!

  1. <uses-permission android:name="android.permission.SET_WALLPAPER" />

Differences between api versions
On Android 1.5 the wallpaper looks cool, doesn’t it? :) The backgroud fills the screen.

But on 1.6 and higher android strechs the wallpaper like this:

It’s not bad if you use high resolution wallpaper, but the low res wallpapers look crappy.