BlackBerry Forums Support Community

BlackBerry Forums Support Community (
-   Developer Forum (
-   -   Menu item (

sonia1986 09-14-2009 02:39 AM

Menu item
import net.rim.device.api.system.*;
import net.rim.device.api.ui.component.Dialog.*;
import net.rim.blackberry.api.menuitem.*;
import javax.microedition.pim.*;

public final class MenuItem extends Application {
private static long ID = 0x7cab1e23b72a0033L; //hash of

public static void main(String[] args) {
MenuItem app = new MenuItem();


MenuItem() {
ApplicationMenuItemRepository amir = ApplicationMenuItemRepository.getInstance();
amir.addMenuItem(ApplicationMenuItemRepository.MEN UITEM_ADDRESSBOOK_LIST, new SampleMenuItem());

static class SampleMenuItem extends ApplicationMenuItem
SampleMenuItem() {

public String toString() {
return "Give me more!";

public Object run(Object context) {

net.rim.device.api.ui.component.Dialog.alert("Hell o, you clikked the give me more menu item");

return null;

when run this program its show on console
Starting App
App is already running.

vivartpandey 09-14-2009 08:24 AM

just give alternate entry point for menu item using.
ApplicationDescriptor app = ApplicationDescriptor
// set the argument so that we know which app we want to have launched
app = new ApplicationDescriptor(app,
new String[] { ARG_LAUNCH_CONTACT_DEMO });

and handle this alternate entry point in main method

All times are GMT -5. The time now is 06:04 AM.

Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.