Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><a href="http://developer.android.com/training/displaying-bitmaps/load-bitmap.html" rel="nofollow">http://developer.android.com/training/displaying-bitmaps/load-bitmap.html</a></p> <p>The link guides you on how to load bitmaps efficiently especialcy the topic under <strong>Load a Scaled Down Version into Memory</strong></p> <p>You should recycle bitmaps when not in use.</p> <pre><code> bitmaps.recycle(); </code></pre> <p>Bitmaps are also stored on heap starting from honeycomb.So recycle bitmaps when not in use.</p> <p><a href="http://www.youtube.com/watch?v=_CruQY55HOk" rel="nofollow">http://www.youtube.com/watch?v=_CruQY55HOk</a>. If you run into memory leaks use a MAT Analyzer to find and fix it. The video has a talk on the topic. It also explains how to manage memory.</p> <p>If you want to display large number of bitmaps use a Universal Image Loader. Use a listview or grdiview to display images.</p> <p><a href="https://github.com/nostra13/Android-Universal-Image-Loader" rel="nofollow">https://github.com/nostra13/Android-Universal-Image-Loader</a>.</p> <p>It is based on Lazy List(works on same principle). But it has lot of other configurations. I would prefer to use <em>Universal Image Loader</em> coz it gives you more configuration options. You can display a error image if downlaod failed. Can display images with rounded corners. Can cache on disc or memory. Can compress image.</p> <p>In your custom adapter constructor</p> <pre><code> File cacheDir = StorageUtils.getOwnCacheDirectory(a, "your folder"); // Get singletone instance of ImageLoader imageLoader = ImageLoader.getInstance(); // Create configuration for ImageLoader (all options are optional) ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(a) // You can pass your own memory cache implementation .discCache(new UnlimitedDiscCache(cacheDir)) // You can pass your own disc cache implementation .discCacheFileNameGenerator(new HashCodeFileNameGenerator()) .enableLogging() .build(); // Initialize ImageLoader with created configuration. Do it once. imageLoader.init(config); options = new DisplayImageOptions.Builder() .showStubImage(R.drawable.stub_id)//display stub image .cacheInMemory() .cacheOnDisc() .displayer(new RoundedBitmapDisplayer(20)) .build(); </code></pre> <p>In your getView()</p> <pre><code> ImageView image=(ImageView)vi.findViewById(R.id.imageview); imageLoader.displayImage(imageurl, image,options);//provide imageurl, imageview and options. </code></pre> <p>You can configure with other options to suit your needs.</p> <p>Along with lazy loading/Universal Image Loader you can view holder for smooth scrolling and performance. <a href="http://developer.android.com/training/improving-layouts/smooth-scrolling.html" rel="nofollow">http://developer.android.com/training/improving-layouts/smooth-scrolling.html</a>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload