/LazyList

This is a fork of the LazyList proyect. The aim of this fork is to contribute and create an Android Library without any reference to Views, and to delay the "imageView.setImageBitmap" in order to let the implementation do it, do what the final project needs. For example: before set the Image to an ImageView reduce it size, put rounded corners or wathever the other projet need it.

Primary LanguageJavaMIT LicenseMIT

LazyList

A simple library to display images in Android. Images are being downloaded asynchronously in the background. Images are being cached on SD card and in memory. Can also be used for GridView and ListView just to display images into an ImageView or any other View, even custom ones.

Originally published here.

Basic Usage

We recommend to create your view and implement the ImageProcessingCallback there, specially for ListView and BaseAdapter. Check the ".impl" package.

//To use the default external folder, this folder will be deleted when the app no longer exists.
ImageLoader.getInstance().init(getApplicationContext());
//Or to use another folder, use...
//ImageLoader.getInstance().init(getApplicationContext(), "MyExternalFolder");
...
public class MyItemView extends LinearLayout implements ImageProcessingCallback {
...
//Do what you need in methods onImagePreProcessing() and onImageProcessing(Bitmap bitmap)
...
ImageLoader.getInstance().displayImage(data[position], myView);

Don't forget to add the following permissions to your AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

Now the ImageLoader is a Singleton, so you do not need to check for only one instance. But remember to call the init() method.

Check the ".impl" package to learn how to implement the library, it is very easy.

License

LazyList is released under the MIT license.