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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.