page.title=Selection
page.tags=actionmode,navigation,contextual
@jd:body
Selection
Menus: Creating Contextual MenusMaterial Design
Developer Docs
Android 3.0 changed the long press gesture—that is, a touch that's held in the same position for a moment—to be the global gesture to select data.. This affects the way you should handle multi-select and contextual actions in your apps.
In previous versions of Android, the long press gesture was universally used to display contextual actions for a given data item in a contextual menu.
This pattern changed with Android 3.0. The long press gesture is now used to select data, combining contextual actions and selection management functions for selected data into a new element called the contextual action bar (CAB).
The contextual action bar (CAB) is a temporary action bar that overlays your app's current action bar while data is selected. It appears after the user long-presses on a selectable data item.
From here the user can:
You can decide which actions and elements appear in the CAB. Use the guidelines in the Action Bar pattern to decide which items to surface at the top level and which to move to the action overflow.
In most cases you need to adjust the actions in the CAB dynamically as the user adds more items to the selection. Actions that apply to a single selected data item don't necessarily apply to multiple selected data items of the same kind.
Developer Guide
For information about how to create a contextual action bar, read Using the contextual action mode.
Whenever your app supports the selection of multiple data items, make use of the contextual action bar (CAB).
Reserve the long press gesture for selection exclusively. Don't use it to display traditional contextual menus.
If you don't support multi-selection within a list, long press should do nothing.
Plan the actions you want to display inside of a CAB in the same way you would plan the actions inside your app's action bar.