5 minutes

Universal Image Loader Library in Android

By Nilanchala @nilan, On Sep 17, 2023 Android 2.67K Views

In this example we’ll show you how to use Universal Image Loader library in your android project.

What is Universal Image Loader?

Universal Image Loader is an smart and powerful library that helps in loading, caching and displaying images on Android. This means, using this library you can download remote images and display on ImageView.

Universal Image Loader Features

  • Asynchronous and multi-threaded image loading. This allows you to download multiple images Asynchronously.
  • Supports various configurations that helps to tune for your requirement. With this you can control memory, cache type, decoder, display image options, etc.
  • Possibility of image caching in memory and/or on device’s file system (or SD card)
  • Possibility to “listen” loading process. Allows various callback methods using which you will get to know the progress/state of your download request.


Integrating Universal Image Loader in Android

Integrating this library is quite easy. Here we’ll show you steps to download and integrate this library in Android application.

1. Download Universal Image Loader

Download Universal Image Loader JAR and put the JAR in the libs folder of your Android project. You can also fork the library on GitHub

2. Mainfest permissions

Add below required permission in your application Manifest file.

    <uses-permission android:name="android.permission.INTERNET" />
    <!-- Include next permission if you want to allow UIL to cache images on SD card -->
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <application android:name="MyApplication">

3. Library setup in your Application class

import com.nostra13.universalimageloader.cache.memory.impl.WeakMemoryCache;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
import com.nostra13.universalimageloader.core.assist.ImageScaleType;
import com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer;

public class MyApplication extends Application {
	public void onCreate() {

		DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
				.displayer(new FadeInBitmapDisplayer(300)).build();

		ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
				.memoryCache(new WeakMemoryCache())
				.discCacheSize(100 * 1024 * 1024).build();


4. Download and display bitmap on ImageView

//your image url
String url = "";

ImageLoader imageLoader = ImageLoader.getInstance();
DisplayImageOptions options = new DisplayImageOptions.Builder().cacheInMemory(true)
//initialize image view
ImageView imageView = (ImageView) findViewById(		

//download and display image from url
imageLoader.displayImage(url, imageView, options);
nilan avtar


I'm a blogger, educator and a full stack developer. Mainly focused on Java, Spring and Micro-service architecture. I love to learn, code, make and break things.