Remove menu item on Blackberry

老子叫甜甜 提交于 2019-12-11 07:27:48

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!