Support for legacy context menus

Since BlackBerry® Java® SDK 6.0, an application's context menu or short menu is converted to a pop-up menu. Whether you added menu items to a context menu or used the items that were added to the context menu by default, you do not have to change your code to have these items appear in the pop-up menu instead. However, BlackBerry Java SDK 6.0 includes classes and interfaces that you can use to build a pop-up menu, and allows you to use the Command Framework API and make your code more modular. For example, if your application has a UI component and a menu item that performs the same function, by using the Command Framework API, you can write the code for that function once and use it throughout your application, as well as make it available for other applications to use.

A context menu item included an ordinal number which determined the placement of the item in the menu. The lower the ordinal number, the higher the position of the item in the menu. When a context menu is converted to a pop-up menu, the menu item that has the lowest ordinal number becomes the default pop-up menu item. The remaining items are added to the pop-up menu from the lowest ordinal number to the highest. If an icon was associated with a menu item in your legacy context menu, it is used for the item in the pop-up menu. Otherwise, a default icon is used. Similar to other pop-up menus, only the first eight context menu items are displayed in the pop-up menu. If the context menu has more than eight menu items, make sure that you use the ordinal numbers for the menu items appropriately so that the most important and useful items appear in the pop-up menu.

For more information about creating context menus, visit the BlackBerry Developer Resource Center at to read Distinguish between a full menu and a primary actions menu.

Was this information helpful? Send us your comments.