# Universal Image Loader
# Basic usage
ImageLoader.getInstance().displayImage(imageUri, imageView);
ImageLoader.getInstance().loadImage(imageUri, new SimpleImageLoadingListener() {
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
// Do whatever you want with the bitmap.
}
});
Bitmap bmp = ImageLoader.getInstance().loadImageSync(imageUri);
# Initialize Universal Image Loader
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this)
// ...
.build();
ImageLoader.getInstance().init(config);
The full configuration options can be found here (opens new window).
# Remarks
Acceptable URI examples:
"http://www.example.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)