问题
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.
回答1:
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);
}
来源:https://stackoverflow.com/questions/4537844/remove-menu-item-on-blackberry