Reputation: 2046
In my Blackberry application, I have screen with few menu items (created by myself in makeMenu()). On this screen, sometimes I should remove two of this menu items. But menu.deleteItem() method does not work.
How i can remove menu item in application menu, without recreate new instance of screen? Is it real for already constructed menu? Or mb I should refresh menu/screen someway?
Thanx.
Upvotes: 1
Views: 1331
Reputation: 3065
The menu is drawn at the point it's selected so all I do is set conditions on anything that's not static, example below:
protected void makeMenu( Menu menu, int instance ) {
menu.add(staticMenuItem);
if (condition) menu.add(dynamicMenuItem);
}
Upvotes: 3