bitmap - wallpaper scrolling on android 4x and above -


another wallpaper question, setting using wallpaper manager found wallpaper doesnt scroll, tried different launchers same thing happening, after alot of research found android version issue , nobody has answered other question found 1 answer gets screen dimensions , bitmaps dimensions on android hive scales bitmap accordingly.

    bitmapwidth = (bitmapwidth * screenheight) / bitmapheight; 

this works! image scrolling image overstrectched im using method , playing screen height , width , bitmap height , width try , sit nicely want image scaled on device , scroll suggestions?

so after playing alot found rather simple after getting dimensions screen height, , bitmap height , width , using

bitmapwidth = (bitmapwidth * screenheight) / bitmapheight; 

i can pass new dimension bitmap height

bitmapheight = bitmap_width; 

im new if bad solution please correct me tried on 2 different phones , 2 different tablets , works case, here full method call;

    private void setwallpaper() throws ioexception {     int screenheight;     int screenwidth;     display display = getactivity().getwindowmanager().getdefaultdisplay();     point size = new point();     display.getsize(size);     screenheight = size.y;     screenwidth = size.x;     bitmap bitmap = ((bitmapdrawable)        wallpaperview.getdrawable()).getbitmap();     int bitmapwidth = bitmap.getwidth();     int bitmapheight = bitmap.getheight();     bitmapwidth = (bitmapwidth * screenheight) / bitmapheight;     bitmapheight = bitmapwidth;     wallpapermanager wallpapermanager =      wallpapermanager.getinstance(getactivity());     wallpapermanager.setbitmap(bitmap.createscaledbitmap     (bitmap,bitmapwidth,bitmapheight,true));         snackbar.make(getactivity().findviewbyid(r.id.walllayout),       "wallpaper set "+"height"+ bitmapheight+ "width"+bitmapwidth,        snackbar.length_long)                 .show();     } 

Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -