Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
joschika77
Posts: 24
Registered: ‎09-12-2008
My Device: Not Specified

Menu Item Problem

Hello, I find in the examples only always "ApplicationMenuItemRepository.getInstance () .addMenuItem (ApplicationMenuItemRepository. MENUITEM_EMAIL_VIEW, this);"  What plays the ID for a role? What must I do to provide own Menu Item?
Developer
peter_strange
Posts: 19,609
Registered: ‎07-14-2008
My Device: Not Specified

Re: Menu Item Problem

Have you looked anywhere for the solution yourself?

 

I recommend searching in at least these three places, before asking a question on the forum:

a) Developer Guide - If you look in the Creating user interfaces chapter you will find a section conveneiently called

Adding menu items to BlackBerry Java Applications

b) This forum - using the keyword "ApplicationMenuItem" you will find a few interesting Threads

c) The KB - see the link to it from here:

http://na.blackberry.com/eng/developers/support/

 

I'm sure, amongst this lot you will be able to answer this question, and hopefully your next few as well!

New Developer
joschika77
Posts: 24
Registered: ‎09-12-2008
My Device: Not Specified

Re: Menu Item Problem

Ha...i have found few interesting Threads. If everything does not function, unfortunately.

I would like to add in the Menu simply Item and use it then. If I provide Item and it adds I must use there always the given Ids?

For Example: 

ApplicationMenuItemRepository.getInstance().addMenuItem(ApplicationMenuItemRepository.MENUITEM_EMAIL_VIEW,this);

 Take a look at my code:

 

 

//Constructor other class (new MyMenuItem(0)).registerInstance(); //Inner class class MyMenuItem extends ApplicationMenuItem { //using the default constructors here. public MyMenuItem(int order) { super(order); } // Register the instance of the menuItem with the system public void registerInstance() { //System.out.println("Registering MyMenuItemDemo"); ApplicationMenuItemRepository.getInstance().addMenuItem(ApplicationMenuItemRepository.MENUITEM_EMAIL_VIEW,this); } //methods we must implement //Run is called when the menuItem is invoked public Object run(Object context) { //context object should be a email message if (context instanceof Message) { Message message = (Message)context; //this is where we would work the message //do something here } return context; } //toString should return the string we want to //use as the lable of the menuItem public String toString() { return "MyMenu Name"; }

 

 

 

 

 

 

BlackBerry Development Advisor
MSohm
Posts: 14,753
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: Menu Item Problem


joschika77 wrote:

I would like to add in the Menu simply Item and use it then. If I provide Item and it adds I must use there always the given Ids?

 


I'm not sure what you are asking here.  Can you elaborate?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Developer
joschika77
Posts: 24
Registered: ‎09-12-2008
My Device: Not Specified

Re: Menu Item Problem

I want to build my own menu with own items.As far as I understand the documentation I have to use standard items. Can't I make my own? What's the meaning of the ids? For example: I don't want to use "MENUITEM_EMAIL_VIEW" - I want to use "MENUITEM_MY_OWN".

The source code I posted before compiled and ran but there was no "EMAIL_VIEW" in the menu.

BlackBerry Development Advisor
MSohm
Posts: 14,753
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: Menu Item Problem

ApplicationMenuItem is used to add menu items to the BlackBerry applications that come on a BlackBerry handheld.

 

MenuItem is used to add menu items to your own application.

 

Where are you trying to add your menu?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Developer
joschika77
Posts: 24
Registered: ‎09-12-2008
My Device: Not Specified

Re: Menu Item Problem

Then I must probably use MenuItem. But I had also already tried this. This was not visible Item. I will try it over again with MenuItem. If I then problems have I will announce myself over again. regards