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
Highlighted
New Developer
Posts: 18
Registered: ‎11-14-2008
My Device: Not Specified
Accepted Solution

add menu item to the Phone Application

Hi,

I would like to add a menu item to the Phone application. i m using JDE 4.3 .
 

please help.

 
thanks

pankaj
Developer
Posts: 16,997
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: add menu item to the Phone Application

extend ApplicationMenuItem and add it using ApplicationMenuItemRepository.
For example:
ApplicationMenuItemRepository.getInstance().addMenuItem(ApplicationMenuItemRepository.MENUITEM_PHONE,
new PhoneMenuItem(0));
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
New Developer
Posts: 54
Registered: ‎11-12-2008
My Device: Bold 9800 or Storm 3 whichever hits Verizon first.
My Carrier: Verizon

Re: add menu item to the Phone Application

Notes

 

I had the same issue. makeMenu() method is called EACH AND EVERY TIME that the menu key is pressed.

Thank you all for your support
black_berry
Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: add menu item to the Phone Application

Developer
Posts: 45
Registered: ‎01-16-2009
My Device: Not Specified

Re: add menu item to the Phone Application

Hi,

 

i am new in blackberry development. I have read the thread and the passage in the devoloper guide according creating custom menu entry. I have set a demo-application but nothing happens. Can anyone give me a hint what i have done wrong?

 

In my app there are to classes (Asteris.java and AsterisMenuItem.java)

 

Asteris.java

 


import net.rim.blackberry.api.menuitem.ApplicationMenuItemRepository;
import net.rim.device.api.system.Application;


public class Asteris extends Application
{
    public static void main(String[] args)
    {
            // Create a new instance of the application
            // and start it's event thread.
            new Asteris().enterEventDispatcher();
    }
   
   
    public Asteris()
    {
           
        AsterisMenuItem asterisMenuItem = new AsterisMenuItem(20);
       
        ApplicationMenuItemRepository
        .getInstance().addMenuItem
        (ApplicationMenuItemRepository.MENUITEM_EMAIL_EDIT,asterisMenuItem);
    }
}

 

 


AsterisMenuItem.java

 

 



import net.rim.blackberry.api.mail.Message;
import net.rim.blackberry.api.menuitem.ApplicationMenuItem;

public class AsterisMenuItem  extends ApplicationMenuItem
{
        //using the default constructors here.
        AsterisMenuItem(int order){
            super(order);
        }

        //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 "Asteris Menu";
        }
    
    
}

 


Sorry for bad english, please help.

 

 

 

 

 

Developer
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: add menu item to the Phone Application

Hi ribun,

Please start a new Post.  It will be easy for tracking and others will find soultion for simillar problems.

 

Any way, i took the same java files of yours and compiled and it gave the desired results. You can see "Asteris Menu" when you select "Compose E-mail" and Press Menu button.

 

One change i did is like made the application Auto run on start up.

 

Tnq.


Use Search. "Accept Solution" If the problem is resolved.
Developer
Posts: 45
Registered: ‎01-16-2009
My Device: Not Specified

Re: add menu item to the Phone Application

Thank you verry much, the "autoru-hint" was the crucial one.

 

Next time i post a question i will create an new thread, but in most foren it is not gladly seen if user create new threads for existing "problems".