1

Blackberry applications have a "menu" list coming up when you hit the Blackberry menu button. (When you inherit from "MainScreen".) But in my application there is only one entry, "Close".

How do I add entries to this menu?

(This is not a dupe of this question, which is about replacing the standard menu with an entirely custom menu.)

Community
  • 1
  • 1
Prof. Falken
  • 24,226
  • 19
  • 100
  • 173

1 Answers1

2

create a menu item using the net.rim.device.api.ui.MenuItem. You can add it to a MainScreen with the addMenuItem(MenuItem item) function.

EDIT

sample code

MenuItem mi=new MenuItem("mymenuitem",1,1);
addMenuItem(mi);
CharlesB
  • 86,532
  • 28
  • 194
  • 218
Timon
  • 376
  • 2
  • 6
  • Cool thanks! Will accept as soon as I have tested on the phone, upvoted for now. – Prof. Falken Feb 16 '11 at 13:01
  • 1
    Just found the knowledge base entry from RIM itself: http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800367/How_To_-_Add_a_custom_menu_item_to_an_existing_BlackBerry_application.html?nodeid=800633&vernum=0 – Timon Feb 16 '11 at 13:07
  • Actually that example from the knowledge base seems to be something different and more complicated. – Prof. Falken Feb 16 '11 at 13:14
  • 1
    The knowledge base article you link to is how to add menu items to existing BlackBerry applications (Messages, Contact List, etc). Not what you're looking for, but a good technique to know about none the less. – Richard Feb 16 '11 at 17:32
  • You're totally right. I think it's a good start anyway (you'll just have to add the MenuItem to your screen instead of the ApplicationMenuItemRepository) – Timon Feb 16 '11 at 19:33