views:

168

answers:

2

Hi there

I am developing a simple app that sets wallpapers based on some user inputs ' I am almost done with my app , I am only missing the code for setting wallpapers . I have been looking for it in lots of websites in vain . Can anybody post a sample code that sets as a wallpaper a drawable that is saved in res folder.

Thanks a lot !

+1  A: 

It's all in the documentation: http://developer.android.com/reference/android/app/WallpaperManager.html

Romain Guy
Thanks Romain ,But to be honest with you i dont really know how to use the documentation as i am just starting to developp android applications and my knowledge in java is still not good enough to allow me to use documentation easily , so it would be really nice of you if you could give a sample code that i could use for setting as wallpaper a drawable that is saved in res forlder Thanks a lot
Amine
A: 

Hi

Works on Android 1.5 and above

public void setWallpaper() {

            Context context = this.getBaseContext(); 
            Bitmap mBitmap = BitmapFactory.decodeResource(getResources(),
                    mImageIds[pos]);
            context.setWallpaper(mBitmap);

}

success_anil
Thank you so much !!!do u know by any chance how I can solve the pixelation problems.I heard that the app: wallpaper set and save produces super crisp wallpapers , does it just use crop method to adjust the wallpaper to the screen ?Thanks a lot once more
Amine
Can't say about that ... I will have to search before making a comment to it
success_anil