java - Scale bitmap and set as wallpaper - height gets messy -


i'm trying scale bitmap screen size , set wallpaper, i've noticed on devices(where screen bit wider) wallpaper little messy in height. can me scale image in right way?

here code:

int widthpx = getwindowmanager().getdefaultdisplay()                         .getwidth();                 int heightpx = getwindowmanager().getdefaultdisplay()                         .getheight();                 // bmp = bitmap.createscaledbitmap(bmp, widthpx, heightpx,                 // true);                 bitmapdrawable drawable = (bitmapdrawable) background                         .getdrawable();                  bitmap bitmap = drawable.getbitmap();                 try {                     wallpapermanager mywallpapermanager = wallpapermanager                             .getinstance(getapplicationcontext());                     bitmap resizedbitmap = bitmap.createscaledbitmap(                             bitmap,                             mywallpapermanager.getdesiredminimumwidth(),                             mywallpapermanager.getdesiredminimumheight(),                             true);                     mywallpapermanager.setwallpaperoffsetsteps(1, 1);                     mywallpapermanager.suggestdesireddimensions(widthpx,                             heightpx);                     mywallpapermanager.setbitmap(resizedbitmap);                      toast.maketext(backgroundpreview.this,                             getstring(r.string.wallpaper_set),                             toast.length_short).show();                     finish();                 } catch (exception e) {                     e.printstacktrace();                     toast.maketext(backgroundpreview.this,                             getstring(r.string.error_setting_wallpaper),                             toast.length_short).show();                 } 


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -