Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set Home Screen Wallpaper

Tags:

android

image

I am developing an application which allow user to take photo and can set the photo home screen wallpaper.
My problem is that after setting the wallpaper the wallpaper is set in small size not as other wallpaper. and when viewed from gallery the image is in usual size. I can not figure out what is the problem. Code to get the image is as follows:

Code to get the photo after snapshot:

if (resultCode == RESULT_OK){
    Bundle extras = data.getExtras();
    bmp = (Bitmap) extras.get("data");
    iv.setImageBitmap(bmp);
}


Code to set the wallpaper:

getApplicationContext().setWallpaper(bmp);


Please help me out with this.

like image 200
aman.nepid Avatar asked Nov 05 '22 14:11

aman.nepid


1 Answers

There is informations to set a wallpaper here : http://android-er.blogspot.in/2011/03/set-wallpaper-using-wallpapermanager.html

You can simply do like this :

 WallpaperManager wallpaperManager = WallpaperManager.getInstance(this);
 wallpaperDrawable = wallpaperManager.getDrawable();
 mImageView.setImageURI(imagePath);

(also see this post : Android - How to set the wallpaper image?)

like image 136
Fabien Sa Avatar answered Nov 15 '22 05:11

Fabien Sa