Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
This chapter uses many Java object-oriented programming capabilities, including classes, anonymous inner classes, objects, methods, interfaces and inheritance. You’ll create a subclass of Android’s Activity class to specify what should happen when the app starts executing and to define the logic of the Tip Calculator. You’ll programmatically interact with EditTexts, a TextView and a SeekBar. You’ll create these components using the Visual Layout Editor and Outline window in Eclipse, and some direct manipulation of the GUI layout’s XML. An EditText—often called a text box or text field in other GUI technologies—is a subclass of TextView (presented in Chapter 3) that can display text and accept text input from the user. A SeekBar—often called a slider in other GUI technologies—represents an integer in the range 0–100 by default and allows the user to select a number in that range. You’ll use event handling and anonymous inner classes to process the user’s GUI interactions.