问题描述
在我的Blackberry应用程序中,我的屏幕上只有几个菜单项(由我自己在 makeMenu() 中创建).在此屏幕上,有时我应该删除其中两个菜单项.但是 menu.deleteItem() 方法不起作用.
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?
感谢.
推荐答案
菜单是在选定的位置绘制的,因此我要做的就是在非静态的任何东西上设置条件,例如:
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);
}
这篇关于删除Blackberry上的菜单项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!