I need to load large image which has 2450 x 2450 pixels dimensions.
Bitmap bitmap = ImageLoader.getInstance().loadImageSync(url,
ImageConfig.getImageOptions());
The problem is, on low end device (phone with less than 1 GB RAM), got out of memory exception.
This is my DisplayImageOptions
public static DisplayImageOptions getImageOptions() {
DisplayImageOptions.Builder options = new DisplayImageOptions.Builder();
options.delayBeforeLoading(10)
//The reason I'm using ARGB_8888 because I need to load bitmap without losing it's quality
.bitmapConfig(Bitmap.Config.ARGB_8888)
.imageScaleType(ImageScaleType.NONE)
//I'm not using disk or memory cache
.cacheOnDisk(false)
.cacheInMemory(false);
return options.build();
}
I tried to add target size based on device resolution, but it's not working, loaded bitmap still has 2450 x 2450 pixels dimensions.
int height = orientation == Configuration.ORIENTATION_PORTRAIT ?
displaymetrics.heightPixels : displaymetrics.widthPixels;
Bitmap bitmap = ImageLoader.getInstance().loadImageSync(imageUri,
new ImageSize(height, height), ImageConfig.getImageOptions());
I tried to change imageScaleType to ImageScaleType.EXACTLY
, loaded bitmap resized to 1225 x 1225 pixels, on all device, I need to get original dimensions for high end device, and resized dimensions for low end device.
The main problem is target size is not working
Any idea how should I load the image, especially for low end device?