I am trying to make the wallpaper fit to screen. I tried many solutions on this site but none worked for me except this one, but the image doesn't cover the screen. It kind of shrinks and it can appear anywhere on the screen, mostly in the center. The image size changes again on next reboot. E-g it appears in the middle and is much smaller than the screen size but when I reboot my device, the image size exceeds the bounds of the screen
- How can I make it fit to the screen?
- If I can't, how can I make it appear in the center permanently?
- Does it depend on the dimensions (width, height) of the image too?
Below is my code:
Bitmap bitmap = BitmapFactory.decodeResource(getResources(),
imageIDs[imageIDforWallPaper]);
int w = bitmap.getWidth();
int h = bitmap.getHeight();
WallpaperManager wm = (WallpaperManager) getSystemService(WALLPAPER_SERVICE);
try {
wm.setBitmap(bitmap);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
wm.suggestDesiredDimensions(w, h);