8

As shown below. The first image is the default image linked at http://goldentrail.towardstech.com/assets/images/membersimage/buttons/eat.png. while the second image below it is the image that is loaded using uil

This is the imageloader configuration

    File cacheDir = StorageUtils.getCacheDirectory(context);
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
            .memoryCacheExtraOptions(480, 800) // default = device screen dimensions
            .discCacheExtraOptions(480, 800, CompressFormat.JPEG, 75)
            .taskExecutor(AsyncTask.THREAD_POOL_EXECUTOR)
            .taskExecutorForCachedImages(AsyncTask.THREAD_POOL_EXECUTOR)
            .threadPoolSize(3) // default
            .threadPriority(Thread.NORM_PRIORITY - 1) // default
            .tasksProcessingOrder(QueueProcessingType.FIFO) // default
            .denyCacheImageMultipleSizesInMemory()
            .memoryCache(new LruMemoryCache(2 * 1024 * 1024))
            .memoryCacheSize(2 * 1024 * 1024)
            .discCache(new UnlimitedDiscCache(cacheDir)) // default
            .discCacheSize(50 * 1024 * 1024)
            .discCacheFileCount(100)
            .discCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
            .imageDownloader(new BaseImageDownloader(context)) // default
            .imageDecoder(new BaseImageDecoder()) // default
            .defaultDisplayImageOptions(DisplayImageOptions.createSimple()) // default
            .enableLogging()
            .build();

this is the displayoptions

DisplayImageOptions options = new DisplayImageOptions.Builder()
    .bitmapConfig(Bitmap.Config.ARGB_8888) // default
    .cacheInMemory()
    .cacheOnDisc()

    .build();

enter image description here

ericlee
  • 2,703
  • 11
  • 43
  • 68

2 Answers2

14

Did you see comment in Readme:

DON'T COPY THIS CODE TO YOUR PROJECT! This is just example of ALL options using.

Don't use .discCacheExtraOptions(480, 800, CompressFormat.JPEG, 75). Your images saved in disc cache as JPEG files which can't have transparent background.

nostra13
  • 12,377
  • 3
  • 33
  • 43
  • Yes, try something like `.discCacheExtraOptions(480, 800, CompressFormat.PNG, 75, null)` if you use PNG. Otherwise disable caches. – Muz Jan 20 '14 at 05:29
  • Sorry I forgot to uninstall the app. It was taking images from cache. – berserk Jun 06 '14 at 07:15
  • It's deprecated now, any workaround? (There is even no class CompressFormat in UIL) – hkop May 03 '16 at 11:38
0

Try to use android-query. This API helps with images and some others works with android.

Gabriel Augusto
  • 1,002
  • 11
  • 18