Fragmented Podcast Episode #5: Image libraries for Android

Опубликовано: 27 Февраль 2025
на канале: Fragmented - Android Developer Podcast
88
5

In this episode of Fragmented, Donn and Kaushik start off by discussing the tips and tricks available for efficiently loading images in an Android app. Good image libraries make use of these techniques and perform all the heavy lifting in the background. So they then discuss the different image library options available for Android developers.

Show Notes
Techniques/tips on effective image rendering in Android:
Bitmap sizes and allocation:
Displaying bitmaps efficiently [developer.android.com]
RGB_565, ARGB_888 and other different bitmap configurations [developer.android.com]
Android Camera2 apis [developer.android.com]
Chet Haase DevByte : Bitmap allocation [youtube.com] (bitmaps managed in Dalvik heap post 3.0; so large bitmaps implies large heap implies GC could happen more often)
Reuse bitmaps:
inBitmap option for Android 3.0 and later [developer.android.com]
before Android 4.4 only equal sized bitmaps with inSampleSize 1 supported [developer.android.com]
Reusing bitmap objects on Android[booking.com]
Downsample bitmaps
Load a scaled down version into memory [developer.android.com]
see code for calculateInSampleSize
Caching
Cache Algorithms – see LruCache [wikipedia.org]
LruCache object in Android [developer.android.com]
Jake Wharton DiskLruCache [github.com]
Don’t use Soft or Weak References for your Caches [developer.android.com]
Android Performance Pattern DevByte – why 60fps [youtube.com]
Image libraries for Android:
Picasso by Square [github.com]
fetch introduced in V 2.5.0 (Changelog) [github.com]
Picasso doesn’t do bitmap recycling
Jake Wharton’s thoughts on Picasso not having a bitmap pool [github.com]
Glide [github.com]
github issue where author explains tags being used to store metadata [github.com]
Glide does bitmap recycling
Ion
DeepZoom with Ion [youtube.com]
Uses BitmapRegionDecoder to implement DeepZoom [developer.android.com]
Volley
Ficus Kirkpatrick introduces Volley in Google.IO [youtube.com]
Doesn’t come with an image caching mechansim out of the box [stackoverflow.com]
Fresco
Introducing Fresco [code.facebook.com]
Romain Guy concern over native api call [twitter.com]
Other noteworthies that we did not discuss:
Universal Image Loader Library comparisons by others:
Picasso vs Glide [inthecheesefactory.com]
Image library comparisons:
Jesse Wilson on Picasso vs Fresco :P [twitter.com]
Jesse Wilson Picasso:Glide :: Coke:Pepsi [twitter.com]
Image comparisons by Koushik Dutta [plus.google.com]
Volley vs Picasso [bignerdranch.com]
Awesome picks:
Donn
Moshi – A new modern JSON library for Android and Java from the Square guys
JsonSchemaToPojo: Take json or a json schema and turn it into POJOs.
Parcelabler: Generate Parcelable implementations with a click of a button
Parceler: Android parcels created through Code generation
KG:
Not your father’s Java: 3 part blog post series An opinionated guide to modern Java development
Stetho caster.io screencast: Debugging Android with Stetho – Donn’sscreencast
Cleartones: professional ringtones!
Contact
Donn Felker
@donnfelker [twitter.com]
donnfelker.com
Kaushik Gopal
@kaushikgopal [twitter.com]
kaush.co