Local Image Caching solution for Android:square Picasso vs Universal Image Loader

Source: Internet
Author: User

Local Image Caching solution for Android:square Picasso vs Universal Image Loader

http://stackoverflow.com/questions/19995007/ Local-image-caching-solution-for-android-square-picasso-vs-universal-image-load Picture Cache Library Usage Comparison

Question

I need async image loading and caching in Android. Anyone knows about these and libraries? I was going to the use of Picasso, but I found Universal Image Loader are more popular on Github. A Summary of pros and cons would be great. (All my images be on disk locally, so I don ' t need networking, I don ' t think volley is a fit)

Answers

If you read this post on g+ by Koush you'll get clear solutions for your confusions, I has put the summary of that, in That Android-universal-image-loader was the winner for your requirement!

    • Picasso have the nicest image API if you are using network!
    • Urlimageviewhelper +androidasync is the fastest. Playing with these and other great libraries has really highlighted, the image API is quite dated, however.
    • Volley is slick; I really enjoy their pluggable backend transports,and may end up dropping androidasync in there. The request Priorityand cancellation management is great (if you are using network)
    • Android-universal-image-loader is the most popular one out therecurrently. Highly customizable.

This project aims to provide a reusable instrument for asynchronous image loading, caching and displaying. It is originally based on Fedor Vlasov ' s project and have been vastly refactored and improved since then.

Upcoming changes in new UIL version (1.9.2):

Possibility to the imageloader out of the UI threadnew Disk Cache API (more flexible). New Lrudisccache based on Jake Wharton ' s disklrucache.

Considering all this android-universal-image-loader suites your requirement (Loading the images is on disk locally)!

----------

Koushik Dutta ' s comparison is mostly for speed benchmark. His post was only touched very basic things, and was not specific for local images. I ' d like to share my experiences with Picasso and UIL after I asked the question. Both Picasso and UIL can load local images. I first tried Picasso and is happy, but the later I decided to switch to the UIL for more customization options.

Picasso:
  • Picasso ' s fluent interface is nice. But jumping around with "to", "to", "load" you actually don ' t know what's behind the scene. It ' s confusing what's returned.
  • Picasso allows you to specify exact target size. It's useful when you had memory pressure or performance issues, you can trade off some image quality for speed.
  • Images is cached with a size in its key, it's useful when you display Images with different sizes.
  • You can customize the memory cache size. But it disc cache is only for HTTP requests. For local images, if you are about loading speed, it's good to having a thumbnail disk cache so you don't have to read Seve Ral MBs for an image every time. Picasso does not has this mechanism resizing and saving thumbnails on disk.
  • Picasso does not expose the access to its cache instance. (You can get a hold for it when you first configure Picasso and keep it around ...).
  • Sometimes want to asynchronously read image into a bitmap returned by a listener. Surprisingly Picasso doesn ' t has that. "Fetch ()" Dose not pass the back anything. "Get ()" is for synchronously read, and "load ()" are for asynchronously draw a view.
  • Picasso only had a few simple examples on the homepage, and you'll have to read through the unordered Javadoc for advanced Usages.
UIL:
  • UIL uses builders for customization. Almost everything can be configured.
  • UIL does not allow you to specify the size of you want to load into a view. It uses some rules based on the size of the view. It ' s not as flexible as Picasso. I have no-to-load a lower resolution image to reduce memory footprint. (Edit:this behavior can be easily modified by adding a ImageSize argument in in the source code and bypass the view size Checking
  • UIL provides customizable disc cache, you can use this to cache the thumbnails with specified size. But it's not perfect. Here is thedetails. (Edit:if you care about speed and want multiple levels of thumbnail caching, like my case, you can modify the source code , let the disk cache use "Memorykey", and make it also size sensitive)
  • UIL By default caches images of different sizes in memory, and it can be turned off in configuration.
  • UIL exposes the backing memory and disk cache you can access.
  • UIL provides flexible ways can get a bitmap or load to a view.
  • UIL is better in documentation. UIL gives the detailed usages on the Github page, and there ' s a linked tutorial.

I suggest starting with Picasso, if you need more control and customization, go for UIL.

Local Image Caching solution for Android:square Picasso vs Universal Image Loader

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.