Time for action - the GalleryAdapter

Creating the GalleryAdapter is much like the ListAdapter classes we created in Chapter 2, Presenting Data for Views. The GalleryAdapter however, will use ImageView objects instead of TextView objects. It also binds two lists of resources together instead of using an object model.

  1. Create a new Java class in your project root package named GalleryAdapter. It should extend the BaseAdapter class.
  2. Declare an integer array to hold the thumbnail resource IDs:
    private final int[] thumbnails = new int[]{ R.drawable.curry_view_thn, R.drawable.jai_thn, // your other thumbnails };
  3. Declare an integer array to hold the full-size image resource IDs:
    private final int[] images = new int[]{ R.drawable.curry_view, R.drawable.jai, ...

Get Android User Interface Development now with O’Reilly online learning.

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