实例化一个菜单项
我的黑莓演示类遇到以下问题:
MenuItem locatorItem = new MenuItem(new StringProvider("Location Search"), 0x230020, 0);
locatorItem.setCommand(new Command(new CommandHandler()
(...)
我使用 Eclipse 和黑莓模拟器来运行此演示,但出现“无法实例化类型 MenuItem”错误。我不知道为什么,也没有建议解决它。 我导入了“net.rim.device.api.ui.MenuItem;”。
I have the following problem with a blackberry demo class:
MenuItem locatorItem = new MenuItem(new StringProvider("Location Search"), 0x230020, 0);
locatorItem.setCommand(new Command(new CommandHandler()
(...)
I am using Eclipse and a BlackBerry simulator to get this demo running and I get the 'Cannot instantiate the type MenuItem' error. I don't know why and there's no suggestion to solve it.
I imported 'net.rim.device.api.ui.MenuItem;'.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您使用了错误类型的 MenuItem。您使用的
net.rim.device.api.ui.MenuItem
特定于 Blackberry。如果这是 J2ME 应用程序/Midlet,只需创建一个
javax.microedition.lcdui.Command
。它们被变成黑莓上的菜单项。如果您还在应用程序中使用
net.rim.device.api.ui.Screen
或任何其他net.rim
类,则菜单项通常采用这种方式创建:I think you're using the wrong type of MenuItem.
net.rim.device.api.ui.MenuItem
you are using is specific to the Blackberry.If this is a J2ME Application/Midlet, just create a
javax.microedition.lcdui.Command
. They are turned into menu items on the blackberry.If you're also using
net.rim.device.api.ui.Screen
or any othernet.rim
classes in the application, this is the way menu items are usually created: