BlackBerry Forums Support Community

BlackBerry Forums Support Community (http://www.blackberryforums.com/)
-   Developer Forum (http://www.blackberryforums.com/developer-forum/)
-   -   Menu item (http://www.blackberryforums.com/developer-forum/204139-menu-item.html)

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 com.rim.samples.docs.menuitem

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

}

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

static class SampleMenuItem extends ApplicationMenuItem
{
SampleMenuItem() {
super(20);
}

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;
}
}
}

Hello
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
.currentApplicationDescriptor();
// 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 12:12 AM.

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