Sushant Sharma
Sushant Sharma

Reputation: 54

Avoid zooming of wallpaper

Can anyone tell be how to exactly set the wallpaper on android without it being zoomed..at the moment no matter what resolution image i am using,it is just zooming it and setting as wallpaper..here is the code i am using

setWallpaper.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                WallpaperManager wManager;
                try {                
                //  Bitmap bitmap = ((BitmapDrawable)imageView1.getDrawable()).getBitmap();
                    wManager = WallpaperManager.getInstance(getApplicationContext());
                    wManager.setBitmap(bitmaptwo);
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }

Upvotes: 1

Views: 903

Answers (1)

Sushant Sharma
Sushant Sharma

Reputation: 54

Fixed It..just use this instead

setWallpaper.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                WallpaperManager wManager;

                try {

                //  Bitmap bitmap = ((BitmapDrawable)imageView1.getDrawable()).getBitmap();
                    wManager = WallpaperManager.getInstance(getApplicationContext());
                    fullWidth = wManager.getDesiredMinimumWidth();
                    fullHeight = wManager.getDesiredMinimumHeight(); 
                    Bitmap bitmapResized = Bitmap.createScaledBitmap(bitmaptwo, fullWidth, fullHeight,true);
                    wManager.setBitmap(bitmapResized);


                } catch (IOException e) {
                    e.printStackTrace();
                }
            }

        });

Upvotes: 1

Related Questions