If you are using Internet Explorer, please remove blackberry.com from your compatibility view settings.

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
Developer
arindamhit
Posts: 271
Registered: ‎12-24-2010
My Device: BlackBerry 10
My Carrier: Airtel

How to change the Menu Item position on the Menu List?

I am trying to add one menu item in the Menu List in BlackBerry. But the issue is, after clicking the menu button, my menu option is adding as the topmost menu and it is not coming in the focus. So i have scroll up and click that menu.

 

For this i have write this code to add the menu only to view the email:

 

SampleMenuItem mi = new SampleMenuItem(3);
    mi.setIcon(ImageFactory.createImage("image.png"));
    amir.addMenuItem(ApplicationMenuItemRepository.MENUITEM_EMAIL_VIEW, mi);

 And here is my Sample Menu item class :

 

    private class SampleMenuItem extends ApplicationMenuItem {


        SampleMenuItem(ApplicationDescriptor app) {
            super(20);
        }

        public String toString() {
            return Constants.MSG_OPEN_WITH;
        }

        public Object run(Object context) {

............
  }
}

  How can we add the menu in the middle of the menu list means change the menu position and make it focused??

Please use plain text.
Developer
simon_hain
Posts: 15,893
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: How to change the Menu Item position on the Menu List?

experiment with the order parameter. 20 is a very low value, try something bigger like 500.000

this article relates to normal menu items, not applicationmenuitem, but maybe it is relevant anyhow?
http://www.slashdev.ca/2008/05/07/menuitem-demystified/
----------------------------------------------------------
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
Please use plain text.
Developer
arindamhit
Posts: 271
Registered: ‎12-24-2010
My Device: BlackBerry 10
My Carrier: Airtel

Re: How to change the Menu Item position on the Menu List?

But then i can i get the focus on that menu?? I mean when i will open the menu list, it should focus my added menu item only.

Please use plain text.
Developer
simon_hain
Posts: 15,893
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: How to change the Menu Item position on the Menu List?

no, setting a default menu item can only be done by the application that controls the menu.
----------------------------------------------------------
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
Please use plain text.
Contributor
khalandar
Posts: 41
Registered: ‎09-27-2010
My Device: Not Specified

Re: How to change the Menu Item position on the Menu List?

I am trying to put image also in MenuItem but image is not appearing.

 

I tryed through consturctor

         super(order, ImageFactory.createImage("image.png"));

 

and through setIcon Method

         mi.setIcon(ImageFactory.createImage("image.png"));

 

any solutions for this?

Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: How to change the Menu Item position on the Menu List?

This is a different question to the one on this Thread, so please start your own Thread. 

 

When you start you own Thread can you describe the environment you are using (JRE level, OS level on device, type of device etc) and also give us a sample of the icon that you are having problems with. 

Please use plain text.