Options, Context, and Popup Menus
Learn about different menus in Android.
We'll cover the following
Introduction
In this lesson, we’ll learn about menus in Android. You can create options menus, context menus, and popup menus in your Android apps, and each of these menus serves specific use cases.
Options menu
The options menu is considered the main menu for the activity. It should be used for allowing access to primary functionalities of the activity, such as “Search,” “Settings,” and “Help.” Let’s learn how to create an options menu in an Android app.
Step 1: Define the layout
First, we need to define the layout for the menu containing the menu items, with the title and icon specified. Create a resource file called menu_options_menu.xml
in res/menu
and add the following contents to it.
Get hands-on with 1200+ tech skills courses.