Android - Cache images in android

2,087 views
1,779 views

Published on

Comparison of various image loading and cache technologies on the Android platform.

Published in: Software, Technology, Art & Photos
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,087
On SlideShare
0
From Embeds
0
Number of Embeds
27
Actions
Shares
0
Downloads
26
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Android - Cache images in android

  1. 1. Cache images in Android Ali Muzaffar
  2. 2. The goal  Async download and cache images from the inter-web.  Should be easy to maintain.  Should handle large hi-res images.  Should be as efficient as possible.  Low memory usage.  Fast display of images.  Optionally, image transformations.
  3. 3. The contenders  Bitmap Cache http://developer.android.com/training/displaying-bitmaps/cache- bitmap.html  Google Volley https://android.googlesource.com/platform/frameworks/volley  Chris Bane’s Android-BitmapCache https://github.com/chrisbanes/Android- BitmapCache  Wu Man’s AndroidImageLoader https://github.com/wuman/AndroidImageLoader/  Android-Query (AQuery) https://code.google.com/p/android-query/  Picasso http://square.github.io/picasso/
  4. 4. Comparison Google Google Volley Android- BitmapCache Android- ImageLoader AQuery Picasso Ease of use Hard Easy Normal Easy V. Easy V. Easy Loading image No Yes No Yes Yes Yes Error image No Yes No Yes Yes Yes Efficiency Good Excellent V. Good V. Good Excellent Excellent Image Transform No No No Sort of Yes Yes Other features No Sort of No No Yes Yes Hi-Res Images Normal Excellent Good Good Excellent Excellent Overall 5 2 4 3 1 1
  5. 5. Notes on Google Code  PRO  Lots of control.  You can get most of the code from Google.  Compatible with older Android versions.  CONS  Lots of coding required.  You are responsible for caching on flash or in memory.  No transformation controls.
  6. 6. Google Volley  PROS  Very efficient.  Innovative caching of images so they load in batches.  Backward compatible.  Very little code required.  Built with parallel operations in mind.  Great support for cancelling network operations.  CONS  No image transformation support.  Holds the entire server response in memory, if the server response is 1MB or greater this could be an issue.  No built in prefetching (though you can code it).  Very little Documentation (mostly Javadoc and a Video).
  7. 7. Notes on Chris Bane’s Android- BitmapCache  PROS  Efficient.  Uses reliable libraries (Jake Whartons LruCache & CacheableImageView).  Compatible with old versions.  Provides implementation for downloading images from the network.  Good samples.  Frequent updates.  CONS  Too many libraries.  No image transformation support.  Does not (by default) support downloading images from the Network.  No documentation.  Not fast enough.  Need to extend Application.
  8. 8. Wu Man’s AndroidImageLoader  PROS  Efficient.  Image placeholders.  Supports downloading of images, error handling.  Good documentation & samples.  Self contained.  CONS  Recycling views old image was visible for a second.  Min SDK 7.  Not updated in 8 months.  Not fast enough.  Need to extend Application.
  9. 9. AQuery (Android-Query)  PROS  Fast and very efficient (best in my tests by far).  Single jar to include (200KB).  Placeholders, image transformation, error handling etc..  Amazing set of features.  Backward compatible.  App provided which shows off all the features and the source code used.  CONS  Have to use AQuery syntax.  200KB for full or 100KB for core. Big?
  10. 10. Picasso or Android Disclaimer: Not Tested for Efficiency  PROS  Fast & Efficient.  Easy to use.  Self contained single jar (95KB).  Placeholders, image transformation, error handling etc.  Image specific features, including cropping.  CONS  Has it’s own syntax.  Decent documentation but could be better.  95KB. Big?
  11. 11. Question  Do you really need to download images from the inter-web?

×