Dont take over the BACK key unless you absolutely need to

As a user navigates from one activity to the next, the system adds them to the activity stack. This forms a navigation history that is accessible with the BACK key. Most activities are relatively limited in scope, with just one set of data, such as viewing a list of contacts, composing an email, or taking a photo. But what if your application is one big activity with several pages of content and needs finer-grained control of the BACK key? Examples of such Google applications are the Browser, which can have several web pages open at once, and Maps, which can have several layers of geographic data to switch between. Both of these applications take control of the BACK key and maintain their own internal back stacks that operate only when these applications have focus.

For example, Maps uses layers to present different information on a map to the user: displaying the location of a search result, displaying locations of friends, and displaying a line for a street path providing direction between points. Maps stores these layers in its own history so the BACK key can return to a previous layer.

The Android system provides two types of menus you can use to provide functionality or navigation. Between them, you should be able to organize the functionality and navigation for your application. Briefly:

• The Options menu contains primary functionality that applies globally to the current activity or starts a related activity. It is typically invoked by a user pressing a hard button, often labeled MENU.

• The Context menu contains secondary functionality for the currently selected item. It is typically invoked by a user's touch & hold on an item. Like on the Options menu, the operation can run either in the current or another activity.

All but the simplest applications have menus. The system automatically lays the menus out and provides standard ways for users to access them. In this sense, they are familiar and dependable ways for users to access functionality across all applications. All menus are panels that "float" on top of the activity screen and are smaller than full screen, so that the application is still visible around its edges. This is a visual reminder that a menu is an intermediary operation that disappears once it's used.

Let's start out with a quick tour of the menus.

0 0

Post a comment