How to use Universal Image Loader

前端 未结 5 2092

I have a requirement where I need to load thumbnails and a Text in ListView which gets set by the custom Adapter. The Thumbnails shoul

5条回答
  •  醉梦人生
    2020-12-09 19:37

    I will suggest you using AQuery - (Android-Query) - a super simple UI manipulation framework for Android.

    AQuery comes as a library, which you need to include in your build path.

    In AQuery, you can download, display (with effects) and cache the image (both in memory and disk) with following lines:

    AQuery aq = new AQuery(yourActivity.this);
    boolean memCache = true;
    boolean fileCache = true;
    aq.id(R.id.image1).image("http://www.example.com/image.jpg", memCache, fileCache);
    

    AQuery will handle all the data downloading processes, and will display images on your ImageView you've given. Once you load the image, it will be cached in the memory (or disk) according to the boolean parameters memCache and fileCache. The next time, it will load the image from the memory cache or file cache.

    For more information and examples, you should visit the AQuery Project at http://code.google.com/p/android-query/

    More code on Image Loading - http://code.google.com/p/android-query/wiki/ImageLoading

提交回复
热议问题