Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Distinguish between a full menu and a primary actions menu

by Retired ‎02-16-2010 12:58 PM - edited ‎09-16-2010 03:49 PM (7,757 Views)



This article applies to the following:

  • BlackBerry® Device Software 4.2 and later
  • BlackBerry Java® Development Environment (BlackBerry JDE)



With the addition of the trackball and menu key to BlackBerry smartphones, menus have been divided into two categories: primary action menus and full menus. A trackball click should perform one of two actions: execute the default action (such as opening an email message), or display the primary actions menu (short menu). The menu key is used to display the full menu (default menu), which contains all menu items for the current screen. To build a primary actions menu, an application just needs to place a check in the makeMenu() method to determine which menu has been invoked. The following is a sample that demonstrates this:



public void makeMenu(Menu menu, int instance) {

//Add the default menu items. Remove this line to
//prevent the default Close, Switch Application and field
//context menu items from appearing (copy, paste, etc...).
super.makeMenu(menu, instance);

//add these items to the full menu
if (instance == Menu.INSTANCE_DEFAULT) {

//add these items to the both the primary actions menu and the full menu



Note: An application can override the context menu items (cut/copy/paste) for normal operations or when in selection mode. To accomplish this, place a check inside the makeMenu method for the Menu.INSTANCE_CONTEXT for regular items, or Menu.INSTANCE_CONTEXT_SELECTION when in selection mode.

Users Online
Currently online: 13 members 614 guests
Please welcome our newest community members: