Android-Universal-Image-Loader
Powerful and flexible library for loading, caching and displaying images on Android.
Top Related Projects
An image loading and caching library for Android focused on smooth scrolling
A powerful image downloading and caching library for Android
An Android library for managing images and the memory they use.
Image loading for Android and Compose Multiplatform.
An Android transformation library providing a variety of image transformations for Glide.
Android library (AAR). Highly configurable, easily extendable deep zoom view for displaying huge images without loss of detail. Perfect for photo galleries, maps, building plans etc.
Quick Overview
The Android Universal Image Loader is a powerful and flexible library for loading, caching, and displaying images on Android devices. It provides a simple and efficient way to manage image loading and caching, making it easier to develop image-heavy Android applications.
Pros
- Highly Customizable: The library offers a wide range of configuration options, allowing developers to tailor the image loading and caching behavior to their specific needs.
- Efficient Caching: The library implements a robust caching mechanism, which helps to reduce network requests and improve the overall performance of the application.
- Asynchronous Loading: The library handles image loading asynchronously, ensuring a smooth user experience and preventing the main UI thread from being blocked.
- Cross-platform Compatibility: The library is designed to work across a wide range of Android devices, from older models to the latest flagship phones.
Cons
- Outdated Codebase: The project has not been actively maintained since 2016, and the codebase may not be compatible with the latest Android SDK versions and best practices.
- Limited Documentation: The project's documentation is somewhat sparse, which can make it challenging for new developers to get started with the library.
- Potential Performance Issues: While the library is generally efficient, there have been reports of performance issues, especially on older or lower-end devices.
- Lack of Active Development: The project is no longer actively maintained, which means that any issues or bugs may not be addressed in a timely manner.
Code Examples
Here are a few examples of how to use the Android Universal Image Loader library:
// Initialize the ImageLoader
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
.memoryCacheSize(2 * 1024 * 1024)
.diskCacheSize(50 * 1024 * 1024)
.diskCacheFileCount(100)
.build();
ImageLoader.getInstance().init(config);
// Load an image from a URL
String imageUrl = "https://example.com/image.jpg";
ImageLoader.getInstance().displayImage(imageUrl, imageView);
// Load an image from a local file
File imageFile = new File("/path/to/image.jpg");
ImageLoader.getInstance().displayImage(imageFile.getAbsolutePath(), imageView);
// Load an image with custom options
DisplayImageOptions options = new DisplayImageOptions.Builder()
.showImageOnLoading(R.drawable.ic_loading)
.showImageForEmptyUri(R.drawable.ic_empty)
.showImageOnFail(R.drawable.ic_error)
.cacheInMemory(true)
.cacheOnDisk(true)
.considerExifParams(true)
.bitmapConfig(Bitmap.Config.RGB_565)
.build();
ImageLoader.getInstance().displayImage(imageUrl, imageView, options);
Getting Started
To get started with the Android Universal Image Loader library, follow these steps:
- Add the library to your project's dependencies:
dependencies {
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
}
- Initialize the ImageLoader in your application's
onCreate()
method:
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
// Initialize the ImageLoader
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this)
.memoryCacheSize(2 * 1024 * 1024)
.diskCacheSize(50 * 1024 * 1024)
.diskCacheFileCount(100)
.build();
ImageLoader.getInstance().init(config);
}
}
- Use the ImageLoader to display images in your app:
// Load an image from a URL
String imageUrl = "https://example.com/image.jpg";
ImageLoader.getInstance().displayImage(imageUrl, imageView);
That's it! You can now use the Android Universal Image Loader library to load and display images in your Android application.
Competitor Comparisons
An image loading and caching library for Android focused on smooth scrolling
Pros of Glide
- Performance: Glide is known for its efficient and fast image loading, with features like bitmap pooling and memory management.
- Flexibility: Glide supports a wide range of image formats, including GIFs, and provides a flexible API for customizing image loading and caching.
- Active Development: Glide has an active community and is regularly updated, ensuring compatibility with the latest Android versions and libraries.
Cons of Glide
- Complexity: Glide has a steeper learning curve compared to Android-Universal-Image-Loader, especially for complex use cases.
- Memory Footprint: Glide may have a slightly higher memory footprint than Android-Universal-Image-Loader, which can be a concern for some use cases.
Code Comparison
Android-Universal-Image-Loader
ImageLoader imageLoader = ImageLoader.getInstance();
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
.memoryCacheSize(2 * 1024 * 1024)
.discCacheSize(50 * 1024 * 1024)
.discCacheFileCount(100)
.build();
imageLoader.init(config);
imageLoader.displayImage(imageUrl, imageView);
Glide
Glide.with(context)
.load(imageUrl)
.placeholder(R.drawable.placeholder)
.error(R.drawable.error)
.into(imageView);
A powerful image downloading and caching library for Android
Pros of Picasso
- Simplicity: Picasso provides a straightforward and easy-to-use API for loading and displaying images, making it a great choice for simple image loading tasks.
- Caching: Picasso automatically handles image caching, reducing the need for manual cache management.
- Transformations: Picasso offers a wide range of built-in image transformations, such as resizing, cropping, and rotating, which can be easily applied to images.
Cons of Picasso
- Limited Customization: Picasso may not provide as much flexibility and customization options as Android-Universal-Image-Loader, especially for more complex image loading scenarios.
- Performance: While Picasso is generally fast, it may not be as optimized for performance as Android-Universal-Image-Loader, especially for large-scale image loading tasks.
Code Comparison
Picasso:
Picasso.get()
.load("https://example.com/image.jpg")
.into(imageView);
Android-Universal-Image-Loader:
ImageLoader.getInstance()
.displayImage("https://example.com/image.jpg", imageView);
Both code snippets demonstrate the basic usage of loading an image from a URL and displaying it in an ImageView
. The main difference is the API syntax, with Picasso providing a more concise and straightforward approach, while Android-Universal-Image-Loader offers a slightly more verbose but potentially more flexible API.
An Android library for managing images and the memory they use.
Pros of Fresco
- Fresco provides a more comprehensive and feature-rich image loading and caching solution compared to Android-Universal-Image-Loader.
- Fresco has better support for complex image formats, such as animated GIFs and WebP, which can be important for modern app development.
- Fresco's architecture is designed to be more efficient and scalable, with features like automatic memory management and progressive loading.
Cons of Fresco
- Fresco has a larger codebase and API surface area, which can make it more complex to integrate and configure compared to Android-Universal-Image-Loader.
- Fresco may have a higher initial overhead and memory footprint compared to Android-Universal-Image-Loader, especially for simple use cases.
Code Comparison
Android-Universal-Image-Loader:
ImageLoader imageLoader = ImageLoader.getInstance();
imageLoader.displayImage(imageUrl, imageView);
Fresco:
DraweeController controller = Fresco.newDraweeControllerBuilder()
.setUri(imageUrl)
.build();
imageView.setController(controller);
Image loading for Android and Compose Multiplatform.
Pros of coil-kt/coil
- Kotlin-first: Coil is written in Kotlin and is designed to work seamlessly with Kotlin-based Android projects, leveraging Kotlin's features and idioms.
- Coroutine-based: Coil uses Kotlin coroutines for asynchronous image loading, which can lead to more efficient and easier-to-manage code.
- Lightweight: Coil has a smaller footprint compared to Android-Universal-Image-Loader, making it a more lightweight option for image loading.
Cons of coil-kt/coil
- Newer project: Coil is a relatively newer project compared to Android-Universal-Image-Loader, which means it may have fewer features and a smaller community.
- Limited platform support: Coil is primarily focused on Android, while Android-Universal-Image-Loader has broader platform support, including iOS and web.
Code Comparison
Here's a brief comparison of how to load an image using both libraries:
Android-Universal-Image-Loader:
ImageLoader imageLoader = ImageLoader.getInstance();
imageLoader.displayImage(imageUrl, imageView);
Coil:
coil.load(imageUrl) {
target(imageView)
}
As you can see, Coil's API is more concise and Kotlin-friendly, while Android-Universal-Image-Loader has a more verbose Java-style API.
An Android transformation library providing a variety of image transformations for Glide.
Pros of Glide Transformations
- Provides a wide range of pre-built image transformations, such as rounded corners, blur, grayscale, and more.
- Integrates seamlessly with the Glide image loading library, making it easy to apply transformations.
- Actively maintained with regular updates and bug fixes.
Cons of Glide Transformations
- Requires the use of the Glide library, which may not be suitable for all projects.
- May have a larger dependency footprint compared to Android Universal Image Loader.
- Limited to the transformations provided by the library, with less flexibility for custom transformations.
Code Comparison
Android Universal Image Loader:
ImageLoader.getInstance().displayImage(imageUrl, imageView);
Glide Transformations:
Glide.with(context)
.load(imageUrl)
.transform(RoundedCorners(16))
.into(imageView)
Android library (AAR). Highly configurable, easily extendable deep zoom view for displaying huge images without loss of detail. Perfect for photo galleries, maps, building plans etc.
Pros of Subsampling Scale Image View
- Optimized for displaying large images without consuming excessive memory
- Supports smooth zooming and panning of high-resolution images
- Provides a customizable user interface for image interaction
Cons of Subsampling Scale Image View
- Requires more setup and configuration compared to Android Universal Image Loader
- May have a steeper learning curve for developers unfamiliar with the library
- Limited support for image caching and loading out of the box
Code Comparison
Android Universal Image Loader:
ImageLoader imageLoader = ImageLoader.getInstance();
imageLoader.displayImage(imageUrl, imageView);
Subsampling Scale Image View:
SubsamplingScaleImageView imageView = new SubsamplingScaleImageView(context);
imageView.setImage(ImageSource.uri(imageUrl));
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Universal Image Loader
The great ancestor of modern image-loading libraries :)
UIL aims to provide a powerful, flexible and highly customizable instrument for image loading, caching and displaying. It provides a lot of configuration options and good control over the image loading and caching process.
Project News
- Really have no time for development... so I stop project maintaining since Nov 27 :(
- UIL [27.11.2011 - 27.11.2015]
- Thanks to all developers for your support :)
Features
- Multi-thread image loading (async or sync)
- Wide customization of ImageLoader's configuration (thread executors, downloader, decoder, memory and disk cache, display image options, etc.)
- Many customization options for every display image call (stub images, caching switch, decoding options, Bitmap processing and displaying, etc.)
- Image caching in memory and/or on disk (device's file system or SD card)
- Listening loading process (including downloading progress)
Android 4.1+ support
Downloads
Documentation
- Quick Setup
- Configuration
- Display Options
- Useful Info - Read it before asking a question
- User Support - Read it before creating new issue
- Sample project - Learn it to understand the right way of library usage
- ChangeLog - Info about API changes is here
Usage
Dependency
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
Acceptable URIs examples
"http://site.com/image.png" // from Web
"file:///mnt/sdcard/image.png" // from SD card
"file:///mnt/sdcard/video.mp4" // from SD card (video thumbnail)
"content://media/external/images/media/13" // from content provider
"content://media/external/video/media/13" // from content provider (video thumbnail)
"assets://image.png" // from assets
"drawable://" + R.drawable.img // from drawables (non-9patch images)
NOTE: Use drawable://
only if you really need it! Always consider the native way to load drawables - ImageView.setImageResource(...)
instead of using of ImageLoader
.
Simple
ImageLoader imageLoader = ImageLoader.getInstance(); // Get singleton instance
// Load image, decode it to Bitmap and display Bitmap in ImageView (or any other view
// which implements ImageAware interface)
imageLoader.displayImage(imageUri, imageView);
// Load image, decode it to Bitmap and return Bitmap to callback
imageLoader.loadImage(imageUri, new SimpleImageLoadingListener() {
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
// Do whatever you want with Bitmap
}
});
// Load image, decode it to Bitmap and return Bitmap synchronously
Bitmap bmp = imageLoader.loadImageSync(imageUri);
Complete
// Load image, decode it to Bitmap and display Bitmap in ImageView (or any other view
// which implements ImageAware interface)
imageLoader.displayImage(imageUri, imageView, options, new ImageLoadingListener() {
@Override
public void onLoadingStarted(String imageUri, View view) {
...
}
@Override
public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
...
}
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
...
}
@Override
public void onLoadingCancelled(String imageUri, View view) {
...
}
}, new ImageLoadingProgressListener() {
@Override
public void onProgressUpdate(String imageUri, View view, int current, int total) {
...
}
});
// Load image, decode it to Bitmap and return Bitmap to callback
ImageSize targetSize = new ImageSize(80, 50); // result Bitmap will be fit to this size
imageLoader.loadImage(imageUri, targetSize, options, new SimpleImageLoadingListener() {
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
// Do whatever you want with Bitmap
}
});
// Load image, decode it to Bitmap and return Bitmap synchronously
ImageSize targetSize = new ImageSize(80, 50); // result Bitmap will be fit to this size
Bitmap bmp = imageLoader.loadImageSync(imageUri, targetSize, options);
Load & Display Task Flow
Applications using Universal Image Loader
MediaHouse, UPnP/DLNA Browser | Prezzi Benzina (AndroidFuel) | ROM Toolbox Lite, Pro | Stadium Astro | Chef Astro | Sporee - Live Soccer Scores | EyeEm - Photo Filter Camera | Topface - meeting is easy | reddit is fun | Diaro - personal diary | Meetup | Vingle - Magazines by Fans | Anime Music Radio | WidgetLocker Theme Viewer | ShortBlogger for Tumblr | SnapDish Food Camera | Twitch | TVShow Time, TV show guide | Planning Center Services | Lapse It | My Cloud Player for SoundCloud | SoundTracking | LoopLR Social Video | HÃr24 | Immobilien Scout24 | Lieferheld - Pizza Pasta Sushi | Loocator: free sex datings | 벨í¡-ê°í¸ ì´ë²¤í¸,컬ë¬ë§,벨ì리,무ë£,ìµì ê°ì,ë§í¬ì | Streambels AirPlay/DLNA Player | Ship Mate - All Cruise Lines | Disk & Storage Analyzer | ç³äºç¾ç§ | Balance BY | Anti Theft Alarm - Security | XiiaLive⢠- Internet Radio | Bandsintown Concerts | Save As Web Archive | MCPE STORE -Download MCPE file | All-In-One Toolbox (29 Tools) | Zaim | Calculator Plus Free | Truedialer by Truecaller | DoggCatcher Podcast Player | PingTools Network Utilities | The Traveler | minube: travel photo album | Wear Store for Wear Apps | Cast Store for Chromecast Apps | WebMoney Keeper
Donation
You can support the project and thank the author for his hard work :)
- PayPal - nostra.uil[at]gmail[dot]com
Alternative libraries
Top Related Projects
An image loading and caching library for Android focused on smooth scrolling
A powerful image downloading and caching library for Android
An Android library for managing images and the memory they use.
Image loading for Android and Compose Multiplatform.
An Android transformation library providing a variety of image transformations for Glide.
Android library (AAR). Highly configurable, easily extendable deep zoom view for displaying huge images without loss of detail. Perfect for photo galleries, maps, building plans etc.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot