View Single Post
Old 03-26-2012, 06:13 PM   #1 (permalink)
New Member
Join Date: Mar 2012
Model: 9930
Carrier: Verizon
Posts: 3
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Please help - Can't create a menu item!

Please Login to Remove!

*Figured it out

I am a first time developer and have been reading every tutorial and every javadoc I come accross (as well as all forum posts) on how to add a menu item to a native blackberry application, but I can't get it to work.

In this code, I am trying to add a button, "Text", to the menu when you're viewing an email, which will invoke a new SMS. On the line with the *, it returns this error:

Multiple markers at this line
- Syntax error on token ".", { expected
- Syntax error on token "getInstance", Identifier expected after this token

Here is the code:

import net.rim.blackberry.api.invoke.Invoke;
import net.rim.blackberry.api.invoke.MessageArguments;
import net.rim.blackberry.api.mail.Message;
import net.rim.blackberry.api.menuitem.ApplicationMenuIte m;
import net.rim.blackberry.api.menuitem.ApplicationMenuIte mRepository;
import net.rim.device.api.ui.container.MainScreen;

public class Notes extends MainScreen{

MyMenuItem myMenuitem = new MyMenuItem(0);
* ApplicationMenuItemRepository.getInstance().addMen uItem(
ApplicationMenuItemRepository.MENUITEM_EMAIL_VIEW, myMenuitem);

class MyMenuItem extends ApplicationMenuItem{
MyMenuItem(int order){

public Object run(Object context){
new MessageArguments( MessageArguments.ARG_NEW_SMS));


public String toString(){
return "TEXT";

What is wrong with this code? Any help would be GREATLY appreciated!

Last edited by yahoopitz : 03-26-2012 at 07:08 PM. Reason: Found a solution
Offline   Reply With Quote