Downloading Lots of Small Things

Currently, PhotoGallery’s networking works like this: PhotoGalleryViewModel calls FlickrFetchr().fetchPhotos() to download JSON data from Flickr. FlickrFetchr immediately returns an empty LiveData<List<GalleryItem>> object and enqueues an asynchronous Retrofit request to retrieve the data from Flickr. That network request executes on a background thread.

When the data download is complete, FlickrFetchr parses the JSON data into a list of GalleryItems and publishes the list to the live data object it returned. Each GalleryItem now has a URL where a thumbnail-size photo lives.

The next step is to go and get those thumbnails. How will you go about this? FlickrFetchr requests only 100 URLs by default, ...

Get Android Programming: The Big Nerd Ranch Guide, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.