Hi I want to show 3 or 4 image in my view that are stored in sdcard the size of images is 1-2 MB approximately. My problem is when I use image in imageview then it throw ou
I have found solution of my problem there is my code :
BitmapFactory.Options options = new BitmapFactory.Options();
options.inTempStorage = new byte[24*1024];
options.inJustDecodeBounds = false;
options.inSampleSize=32;
bmp1=BitmapFactory.decodeFile(filepath1,options);
Bitmap b1=ThumbnailUtils.extractThumbnail(bmp1,30, 30);
iv1.setImageBitmap(b);
if(bmp1!=null){
bmp1.recycle();
}
bmp1=BitmapFactory.decodeFile(filepath1,options);
Bitmap b2=ThumbnailUtils.extractThumbnail(bmp1,30, 30);
iv2.setImageBitmap(b2);
if(bmp1!=null){
bmp1.recycle();
}
similarly I have use it for four image view and set image without OOM Exception
Create a BitmapFactory.Options
and pass a value >1 in inSampleSize (preferably a power of 2) to scale the image down when loading it.