App development for mobile devices is, as discussed in Chapter 2 “App Design Issues and Considerations,” both similar to and different from development for other platforms. Navigation within an app follows this pattern. Different functionality is provided on different screens (windows in a traditional environment), and the app designer has to both provide the capacity to switch between those screens and make it easy and relatively obvious for users to do so when they want or need to access the functionality provided by them.
Likewise, screen design is both similar to and different from the traditional user interface design. In a traditional environment, a window design is made up of a set of visible objects that give the user the ability to accomplish some component of the overall task. This is the same in the mobile environment. However, the objects available for design differ in both form and function, the amount of screen real estate available is much more limited, and often the amount of real estate available changes among devices that can use your app.
This chapter introduces you to many of the principles and components of interface design and navigation in the Android platform. To learn these things, the chapter guides you through the development of MyContactList navigation and the development of the Contact interface. Activities, Layouts, and Intents The primary structural components for an Android app are Activities and Layouts.
These objects work together to present a display that the user can interact with. Intents are objects that are used to switch between activities in an app. All three objects are used as the basis for the structure of your app. Understanding the role and responsibilities of these objects is very important to effective development of an Android app.
Android Navigation and Interface Design the Activity Class the Activity class is designed to handle a single task that the user can perform. Activities almost always have a visible component that allows the user to interact with the activity to perform the task. The Activity class is not directly instantiated in an Android app. Rather, it is subclassed for every activity that the user needs to perform in the app. These subclasses are stored as .java files in the app project’s src folder.
This allows developers to inherit all the functionality of the Activity class and add their own unique functionality through Java code. One of the most important inherited functions of the Activity class is the capability to respond to life cycle events such as on Create and on Pause (refer to Chapter 2for a discussion of the Android life cycle).