O'Reilly logo

Android User Interface Development by Jason Morris

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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)); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required