import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator;
import com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
import com.nostra13.universalimageloader.core.assist.QueueProcessingType;
import com.nostra13.universalimageloader.core.display.BitmapDisplayer;
import com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer;
import android.app.Application;
public class SMBROfficial extends Application {
@Override
public void onCreate() {
super.onCreate();
DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
. showImageOnLoading(R.drawable.deafult_loading)
.showImageForEmptyUri(R.drawable.deafult_loading)
.showImageForEmptyUri(R.drawable.deafult_loading)
.displayer(new FadeInBitmapDisplayer(1500))
.cacheOnDisc(true)
.build();
// Create global configuration and initialize ImageLoader with this configuration
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext())
.threadPriority(Thread.NORM_PRIORITY - 2)
.memoryCacheSize(2 * 1024 * 1024) // 2 Mb
.denyCacheImageMultipleSizesInMemory()
.discCacheFileNameGenerator(new Md5FileNameGenerator())
.memoryCache(new LruMemoryCache(2 * 1024 * 1024))
.memoryCacheSize(2 * 1024 * 1024)
.memoryCacheSizePercentage(13) // default
.discCacheSize(50 * 1024 * 1024)
.discCacheFileCount(100)
.tasksProcessingOrder(QueueProcessingType.FIFO)
.defaultDisplayImageOptions(defaultOptions) // default
.writeDebugLogs()
.build();
ImageLoader.getInstance().init(config);
}
}
and in you adpters and activities
just Intialize it and use it
ImageLoader imageLoader = ImageLoader.getInstance();
imageLoader.displayImage("YOUR URL", holder.IMAGEVIEW);
No comments:
Post a Comment