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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Developer
trivedirujuta
Posts: 436
Registered: ‎10-06-2009
My Carrier: Vodafone
Accepted Solution

Menuitem not removing properly

Hi,

I have made an application which invokes message application in view mode(message content). I am adding one custom menuitem (MENUITEM_EMAIL_VIEW)just before invoking the message so that it can appear in native message view screen.

I am removing the menuitem in onClose method of the screen but it doesn't seem to remove that because I am getting multiple menuitems.I am passing proper menu object refrence. 

 

Any help?

Rujuta Trivedi
Please use plain text.
Developer
peter_strange
Posts: 17,951
Registered: ‎07-14-2008

Re: Menuitem not removing properly

"I am removing the menuitem in onClose method of the screen but it doesn't seem to remove that because I am getting multiple menuitems.I am passing proper menu object reference"

 

My experience is if you do pass the correct Object it will be deleted.  If you don't, it won't be deleted and your request is silently ignored.  My suspicious is that in fact you are not supplying the same Object.  You might be supplying the same reference but it is the Object that is important. 

Please use plain text.
Developer
trivedirujuta
Posts: 436
Registered: ‎10-06-2009
My Carrier: Vodafone

Re: Menuitem not removing properly

I am adding my menuitem before invoking message application using below code:

ApplicationMenuItemRepository.getInstance().addMenuItem

(ApplicationMenuItemRepository.MENUITEM_EMAIL_VIEW,customMenu); 

 

and removing it in onClose method like

ApplicationMenuItemRepository.getInstance().removeMenuItem

(ApplicationMenuItemRepository.MENUITEM_EMAIL_VIEW,customMenu); 



Rujuta Trivedi
Please use plain text.
Developer
peter_strange
Posts: 17,951
Registered: ‎07-14-2008

Re: Menuitem not removing properly

Two tests:

 

a) Make sure that you do go through the onClose() method.  Put a break point in there and go through your processing and see if it is hit. 

 

b) Change your add code to the following:

 

ApplicationMenuItemRepository.getInstance().addMenuItem

(ApplicationMenuItemRepository.MENUITEM_EMAIL_VIEW,customMenu); 

 

ApplicationMenuItemRepository.getInstance().removeMenuItem

(ApplicationMenuItemRepository.MENUITEM_EMAIL_VIEW,customMenu); 

 

ApplicationMenuItemRepository.getInstance().addMenuItem

(ApplicationMenuItemRepository.MENUITEM_EMAIL_VIEW,customMenu); 

 

Now if the remove is failing, you should get two entries everytime.  Do you?

Please use plain text.
Developer
trivedirujuta
Posts: 436
Registered: ‎10-06-2009
My Carrier: Vodafone

Re: Menuitem not removing properly

Thanks a lote for helping me.

I made a silly mistake,I was creating a new instance of custom menu whenever it comes to the method which invokes message apps.

 

Thanks a lot for helping

Rujuta Trivedi
Please use plain text.