Free Android app covering all aspects of addiction, including prevention and treatment

Contextual menus, action mode, Contextual Action Bars and other stuff!

Android Contextual Menus icon

So what’s this all about?

Well, it’s sort of about context menus but different.

It’s all about using the contextual action mode. This lets the user do stuff with the items that they have selected.

Enabling the contextual action mode, displays a Contextual Action Bar at the top of the screen. You can then place action items, which are like menu options, on this bar.

The user selects items from a list for example, chooses an action item and the action linked to that action item is performed on all of the selected items.

Here’s an example

Say you had a list of countries and you want the user to be able to select a couple of them to add to a database. This is where you could use the contextual action mode.

It enables the user to select one or more of the countries in the list. They can then select a Save action item, for example, and all the selected country items will be saved in the database.

Menus. How to use them in your apps

Android menus

What you’ll learn

We’ll show you how to:

  • Create an options menu
  • Place Action items on the Action Bar
  • Create a Context menu
  • Create a Popup menu
  • Use the support library so that you can display Action Bars and popup menus on earlier versions of Android