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
Posts: 21
Registered: ‎07-16-2008
My Device: Not Specified

Is there a way to check if a menu item still exists in the ApplicationMenuItemRepository?

[ Edited ]

In the application, we add an application menu item to the phone app screen(the one that shows up when a call is connected) using the MENUITEM_SYSTEM constant, since MENUITEM_PHONE only seems to add the item in the dialing screen.  We then use the phonelistener to add and remove the menu item when the event we want gets fired.  This works, however there are a couple of problems with this implementation: During multiple simultaneous phone calls(holds, conference) menuitems get added/removed and some persist through our clean up events, and isn't taken off until an uninstall reinstall.  After trying a convoluted series of adds/removes through pretty much every event fired in phone listener, the bug still remains.  Worse off, it isn't consistent from device to device.  Is there a way that when we call our clean up method, that we can do something like: 

 

while(applicationmenuitem exists)

    remove applicationmenuitem;

 

and when we add a menuitem, to check if it's clear:

if(applicationmenuitem does not exist)

    add applicationmenuitem; 

 

 

EDIT: I suppose a static int counter can do what I am asking you as well, but is there a built in way to check if an item still remains in the repository(like an id) in case of logic errors?

Message Edited by PaoloLim on 07-30-2008 12:06 PM
BlackBerry Development Advisor
Posts: 15,784
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Is there a way to check if a menu item still exists in the ApplicationMenuItemRepository?

There is no way to poll to see if an ApplicationMenuItem has been added.  Instead, you can store a value in the RuntimeStore when you add the ApplicationMenuItem.  Then check this value before adding to see if it already exists.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker