Skip to content

Instantly share code, notes, and snippets.

@kevalpatel2106
Created November 11, 2016 07:54
Show Gist options
  • Save kevalpatel2106/bfff4e6726cd93e052ef7ac086fb5b96 to your computer and use it in GitHub Desktop.
Save kevalpatel2106/bfff4e6726cd93e052ef7ac086fb5b96 to your computer and use it in GitHub Desktop.
// UNIVERSAL IMAGE LOADER SETUP
DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
.cacheOnDisc(true).cacheInMemory(true)
.imageScaleType(ImageScaleType.EXACTLY)
.build();
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
getApplicationContext())
.defaultDisplayImageOptions(defaultOptions)
.memoryCache(new WeakMemoryCache())
.discCacheSize(100 * 1024 * 1024).build();
ImageLoader.getInstance().init(config); // Get singleton instance
//Now you can load the image
ImageLoader.getInstance().displayImage("http://i.imgur.com/DvpvklR.png", (ImageView) findViewById(R.id.ic_uil));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment