Time for action - making the gallery work

Now that we've got the GalleryAdapter working, we need to connect the Gallery, the GalleryAdapter, and the ImageView together, so that when a thumbnail is selected, the full-view of that image is displayed in the ImageView object.

  1. Open the ReviewActivity source code in your editor or IDE.
  2. Add AdapterView.OnItemSelectedListener to the interfaces that the ReviewActivity implements.
  3. Below the declaration of the TextSwitcher, declare a reference to the ImageView which will hold the full-size image:
    private TextSwitcher switcher; private ImageView photo;
    
  4. At the end of the onCreate method, find the ImageView named photo and assign it to the reference you just declared:
    photo = ((ImageView)findViewById(R.id.photo)); ...

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.