uiimageview - Android - Out of memory issue in S3 -
i developing android application have 7 sliders in 1 page. ie, 7 questions there , 1 slider corresponding each questions. users can answer question sliding pointer in each slider. in s3 page crashing. using high resolution images section.
is due less heap size in s3? can resolve issue? there method on come issue? frame, need use images less-quality(it's not desirable)?
use below method set image in imageview got this link worked me
public bitmap shrinkbitmap(string file, int width, int height){ bitmapfactory.options bmpfactoryoptions = new bitmapfactory.options(); bmpfactoryoptions.injustdecodebounds = true; bitmap bitmap = bitmapfactory.decodefile(file, 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(file, bmpfactoryoptions); return bitmap; }
Comments
Post a Comment