27Loopers, Handlers, and HandlerThread

Now that you have downloaded and parsed XML from Flickr, your next task is to download and display images. In this chapter, you will learn how to use Looper, Handler, and HandlerThread to dynamically download and display photos in PhotoGallery.

Preparing GridView for Displaying Images

The current adapter in PhotoGalleryFragment simply provides TextViews for the GridView to display. Each TextView displays the caption of a GalleryItem.

To display photos, you need a custom adapter that provides ImageViews instead. Eventually, each ImageView will display a photo downloaded from the mUrl of a GalleryItem.

Start by creating a new layout file for your gallery items called gallery_item.xml. This layout will consist ...

Get Android Programming: The Big Nerd Ranch Guide now with O’Reilly online learning.

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