Book Image

Android User Interface Development: Beginner's Guide

By : Jason Morris
Book Image

Android User Interface Development: Beginner's Guide

By: Jason Morris

Overview of this book

<p>There are over 30,000 applications for Android that have been downloaded over a million times already. What makes yours any different? Building a compelling user-interface that people understand and enjoy is vital for the survival of a new application in an environment where look and feel may be the only thing between a user purchasing your application; or deleting it forever.<br /><br />Working through examples, code-snippets, and screenshots this book introduces the fundamentals of good user-interface design from a developer's point of view. This book will put you above the rest by showing you how to build striking user interfaces to grasp your app users' attention enough to make them shell out some bucks to buy your application.</p> <p>The <em>Android User Interface Development Beginner's Guide</em> will tell you everything you need to know to style your applications from bottom up. Given the importance of user-interface design on a touch-screen device, this book aims to equip its reader with the knowledge required to build killer Android applications. Starting simply, and keeping things easy, this book will take you on a step-by-step journey to understanding the principals of good user-interface design, and how to implement the best user interfaces on an Android mobile device. It aims at building design understanding on a chapter-by-chapter basis, while introducing platform knowledge through examples.</p>
Table of Contents (18 chapters)
Android User Interface Development
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

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));
  5. Now fetch the Gallery object as declared in the main.xml layout resource:

    Gallery photos = ((Gallery)findViewById(R.id.gallery));
  6. Create a new GalleryAdapter and set it on the Gallery object:

    photos.setAdapter(new GalleryAdapter());
  7. Set the OnItemSelectedListener...