I have an app that loads a lot of big images remotely. When I use nostra's Universal Image Loader (https://github.com/nostra13/Android-Universal-Image-Loader) I often get Out Of Memory errors. I don't know how I should set up the imageloader to prevent this.
This is my current ImageLoader specs:
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
.enableLogging()
.memoryCache(new WeakMemoryCache())
.build();
this.imgDispOpts = new DisplayImageOptions.Builder()
.cacheInMemory()
.cacheOnDisc()
.imageScaleType(ImageScaleType.IN_SAMPLE_INT)
.build();
this.imageLoader = ImageLoader.getInstance();
this.imageLoader.init(config);
And yes, I pass imgDispOpts when calling displayImage().
Try the below configuration
You can also use Lazy Loading of images.https://github.com/thest1/LazyList.
Universal Image loader based on Fedor Vlasov's project LazyList. Improved version of LazyList.
I tried to reduce the bitmap size in the bitmap decoder, which worked for me.
In package com.nostra13.universalimageloader.core.decode, open BaseImageDecoder.java,
Try not cache in memory, use
EXACTLY
scale type andRGB_565
for bitmap decoding.You may try this, it worked well for me: