Understanding Android Menus

The key class in Android menu support is android.view.Menu. Every activity in Android is associated with one menu object of this type. The menu object then contains a number of menu items and submenus.

Menu items are represented by android.view.MenuItem. Submenus are represented by android.view.SubMenu. These relationships are graphically represented in Figure 7–1. Strictly speaking, this is not a class diagram but a structural diagram designed to help you visualize the relationships between various menu-related classes and functions.

Image

Figure 7–1. Structure of Android menu-related classes

Figure 7–1 illustrates that ...

Get Pro Android 4 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.