Welcome to the Official BlackBerry Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Using the MenuItem API

0 Likes
Started 02-12-2010 by
Modified 09-17-2010 by

Exercise

 

Write an application that registers a custom Menu Item to the message view screen.

 

Objectives

  • Discover how to make an application auto-start
  • Discover how to register a custom menu item
  • Discover how to perform a task in the menu item’s run() method

Setup

  1. Option MenuItem_1.zip
  2. In the IDE, open the MenuItem.jdw workspace
  3. Open the MenuItemDemo.java source file.

Tasks

  1. Create an instance of MyMenuItem and register the instance
  2. Modify registerInstance to register the custom menu item with the email view screen.
  3. Implement toString to return the custom name for the menu item.
  4. In the run method determine if the object passed into the method is an instance of a message object.
  5. In the run method open a PIM ToDo List for WRITE only.
  6. In the run method save the newly created task to the ToDo List.

Check Your Work

 

Check out MenuItem_2.zip

 

Review

In this exercise, you discovered the following things:

  • to make an application auto-start
  • to register a custom menu item
  • to perform a task in the menu item’s run method
Contributors