Friday, 15 January 2010

java - 7165X786 size of large image could't be display in real device(Tablets) -



java - 7165X786 size of large image could't be display in real device(Tablets) -

i having problem of displaying big image android. have tried done custom- scrollable-image-view .

i have used total view in class , used 7165*786 size of image it. , of 1.11mb of image. able run code in bluestack , see image in couldn't load in real device.

bmlargeimage = bitmapfactory.decoderesource(getresources(), r.drawable.imagewithout); bmlotusimage1 = bitmapfactory.decoderesource(getresources(), r.drawable.lotus);

i using same canvas in ondraw methow below.

canvas.drawbitmap(bmlargeimage, scrollrect, displayrect, paint); canvas.drawbitmap(bmlotusimage1, 45 - newscrollrectx, 255 - newscrollrecty, paint);

i not able display bmlargeimage in real device can see lotus image on device not big one.

should have decode or scale image or else display in real device?

i solution of not displaying image in real device problem simply.

i have removed target sdk error in webservice. start showing image real device , solution displaying image fit screen below.

private static bitmap shrinkbitmap(string backgroundimage, int width, int height) { // todo auto-generated method stub bitmapfactory.options bmpfactoryoptions = new bitmapfactory.options(); bmpfactoryoptions.injustdecodebounds = true; bitmap bitmap = bitmapfactory.decodefile(backgroundimage, bmpfactoryoptions); int heightratio = (int) math.ceil(bmpfactoryoptions.outheight / (float) height); int widthratio = (int) math.ceil(bmpfactoryoptions.outwidth / (float) width); if (heightratio > 1 || widthratio > 1) { if (heightratio > widthratio) { bmpfactoryoptions.insamplesize = heightratio; } else { bmpfactoryoptions.insamplesize = widthratio; } } bmpfactoryoptions.injustdecodebounds = false; bitmap = bitmapfactory.decodefile(backgroundimage, bmpfactoryoptions); homecoming bitmap; }

and have passed image width adn height parameter in method.

bmlargeimage = shrinkbitmap(backgroundimage, 7165, 786);

java android imageview large-files

No comments:

Post a Comment