Skip to Main Content
Programming Android, 2nd Edition
book

Programming Android, 2nd Edition

by Zigurd Mednieks, Laird Dornin, G. Blake Meike, Masumi Nakamura
September 2012
Intermediate to advanced content levelIntermediate to advanced
566 pages
16h 52m
English
O'Reilly Media, Inc.
Content preview from Programming Android, 2nd Edition

Chapter 6. Building a View

Android comes with many requirements that herald complexity in the user interface; it’s a multiprocessing system that supports multiple concurrent applications, accepts multiple forms of input, is highly interactive, and is flexible enough to support a wide range of devices now and in the future. The user interface is both rich and easy to use.

This chapter provides you with the techniques for implementing a graphical interface on Android. It explains the architecture of the Android UI toolkit, while showing you in practical terms how to use basic interface elements such as buttons and text boxes. It also covers event handling, using multiple threads to offload long-running tasks so that the UI doesn’t freeze, and other topics that make user interfaces pleasant and performant.

Android GUI Architecture

The Android environment adds yet another GUI toolkit to the Java ecosystem, joining AWT, Swing, SWT, LWUIT, and others. If you have worked with any of these, the Android UI framework will look familiar. Like them, it is single-threaded, event-driven, and built on a library of nestable components.

The Android UI framework is, like other Java UI frameworks, organized around the common Model-View-Controller (MVC) pattern illustrated in Figure 6-1. It provides structure and tools for building a Controller that handles user input (such as keystrokes and screen taps) and a View that renders graphical information to the screen.

Figure 6-1. Model-View-Controller concept ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Android, 2nd Edition

Learning Android, 2nd Edition

Marko Gargenta, Masumi Nakamura
Learning Embedded Android N Programming

Learning Embedded Android N Programming

Ivan Morgillo, Stefano Viola

Publisher Resources

ISBN: 9781449332921Errata PageSupplemental Content