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
Kiran_Snist
Posts: 174
Registered: ‎01-25-2011
My Device: Not Specified

How to check the existence of a menu item???

Hi,

 

My requirement is to check the existence of a menu item on the screen, so that i could delete it.

 

So, I want to know whether there is a way to know the presence of a particular menu... Thanks in advance!!

Please use plain text.
Developer
simon_hain
Posts: 16,137
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: How to check the existence of a menu item???

you can use toString to check against the name, or, if you know them, the ordinal (which may not be unique though) or the position.
----------------------------------------------------------
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
Kiran_Snist
Posts: 174
Registered: ‎01-25-2011
My Device: Not Specified

Re: How to check the existence of a menu item???

I didn't get you, which method do youu want me to use simon?

Please use plain text.
Developer
simon_hain
Posts: 16,137
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: How to check the existence of a menu item???

i don't want you to use anything, i just listed some options for you to choose from.
----------------------------------------------------------
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.
Visitor
maheshk_360
Posts: 1
Registered: ‎05-18-2012
My Device: blackberry 9930

Re: How to check the existence of a menu item???

i dont think you can delete those item. but you can check their ordinal and Priority.using

 

protected void makeMenu(Menu menu, int instance)

{
   super.makeMenu(menu, instance);
 for(int i = 0; i < menu.getSize(); i++) {
MenuItem menuItem = menu.getItem(i);
System.out.println("Name: " + menuItem.toString() + " Ordinal: " + menuItem.getOrdinal() + " Priority: " + menuItem.getPriority());
}
}

 

also check this link   http://thinkingblackberry.com/?p=96


Please use plain text.