net.rim.blackberry.api.menuitem
Class ApplicationMenuItem

java.lang.Object
  extended by net.rim.blackberry.api.menuitem.ApplicationMenuItem

public abstract class ApplicationMenuItem
extends Object

Provides the functionality to add items to application menus.

Developers should extend an instance of this class and register the instance with the ApplicationMenuItemRepository. Register the instance along with an appropriate context ID, which defines where the menu item appears, as defined by the constants in ApplicationMenuItemRepository. To add menu items for the purpose of sending image or video files, the preferred method is to use the JSR 211 ContentHandler API. Applications registering with ContentHandler.ACTION_SEND and providing an ActionNameMap will have items added to dialogs and/or menus to be invoked as handlers for sending the selected file.

Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

Constructor Summary
Category: Signed ApplicationMenuItem(int order)
          Creates a new ApplicationMenuItem instance with provided menu position.
Category: Signed ApplicationMenuItem(int order, Image icon)
          Creates a new ApplicationMenuItem instance with provided menu position and icon.
Category: Signed ApplicationMenuItem(Object context, int order)
          Creates a new ApplicationMenuItem instance with provided context and menu position.
 
Method Summary
Category: Signed  Image getIcon()
          Returns icon to be displayed in the menu
Category: Signed  int getOrder()
          Returns the display order of this item.
Category: Signed  int hashCode()
          Retrieves a hash code value for this menu item.
Category: Signed abstract  Object run(Object context)
          Runs the menu item given the context.
Category: Signed  void setIcon(Image icon)
          Sets the icon to be displayed in the menu
Category: Signed abstract  String toString()
          Retrieves name menu item should use for display in a menu.
 
Methods inherited from class java.lang.Object
equals, getClass, notify, notifyAll, wait, wait, wait
 



Constructor Detail

ApplicationMenuItem

public ApplicationMenuItem(Object context,
                           int order)
Creates a new ApplicationMenuItem instance with provided context and menu position.

This constructor builds a new ApplicationMenuItem given the item information and an integer representing the position of the item within the menu.

Developers should override this method to take custom actions on the context parameter.

Parameters:
context - Generic object containing context specific data.
order - Display order of this item, lower numbers correspond to higher placement in the menu (relative, an entry of 0 won't necessarily result in the top most item).
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

ApplicationMenuItem

public ApplicationMenuItem(int order,
                           Image icon)
Creates a new ApplicationMenuItem instance with provided menu position and icon.

Parameters:
order - Display order of this item, lower numbers correspond to higher placement in the menu (relative, an entry of 0 won't necessarily result in the top most item).
icon - icon to be displayed if menu supports icons
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 6.0.0

ApplicationMenuItem

public ApplicationMenuItem(int order)
Creates a new ApplicationMenuItem instance with provided menu position.

Parameters:
order - Display order of this item, lower numbers correspond to higher placement in the menu (relative, an entry of 0 won't necessarily result in the top most item).
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0


Method Detail

run

public abstract Object run(Object context)
Runs the menu item given the context.

Developers should override this method and implement specific menu handling.

Parameters:
context - Object containing the context specific information.
Returns:
New context object.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

toString

public abstract String toString()
Retrieves name menu item should use for display in a menu.

Sub-classes should override this to provide the name the menu item should use for display in a menu.

Overrides:
toString in class Object
Returns:
String describing this menu item; must not be null.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

getOrder

public int getOrder()
Returns the display order of this item.

Returns:
The order of the ApplicationMenuItem.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 6.0.0

hashCode

public int hashCode()
Retrieves a hash code value for this menu item.

Note: this method builds a hash out of this menu item's current position, a hash of its cookie, and a hash of the results of ApplicationMenuItem.toString().

Overrides:
hashCode in class Object
Returns:
Hash value for this menu item.
See Also:
Object.equals(java.lang.Object), Hashtable
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

getIcon

public Image getIcon()
Returns icon to be displayed in the menu

Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 6.0.0

setIcon

public void setIcon(Image icon)
Sets the icon to be displayed in the menu

Parameters:
icon - new icon
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 6.0.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal