Shoham Ben-Har
Shoham Ben-Har

Reputation: 327

Android UniversalImageLoader configuration

I'm using UniversalImageLoader for my android application. My app is something like Instagram, i.e. shows a lot of images (every user create its images collection and other users can browse other users images). I tried to configure UniversalImageLoader as follows:

ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
            getApplicationContext())
            .threadPriority(Thread.MAX_PRIORITY).threadPoolSize(5)
            .discCache(new UnlimitedDiscCache(cacheDir))
            .denyCacheImageMultipleSizesInMemory()
            .memoryCache(new UsingFreqLimitedMemoryCache(6 * 1024 * 1024))
            .discCacheFileNameGenerator(new Md5FileNameGenerator())
            .tasksProcessingOrder(QueueProcessingType.LIFO).build();

My question is about the threadPriority and threadPoolSize. I tried to set the threadPriority to be NORM and threadPoolSize to 3 but the images load slowly so I changed it to MAX_PRIORITY and threadPoolSize to 5. Is it good practice to set the threadPriority the MAX_PRIORITY and threadPoolSize to 5? or is it going to do me performance problems?

Thanks.

Upvotes: 1

Views: 160

Answers (1)

Md Rahman
Md Rahman

Reputation: 1820

You have mentioned ,your app will show a lot of images.

For getting better performance you can use LazyList

GitHub Link https://github.com/thest1/LazyList

Upvotes: 1

Related Questions