Lwuit:PeerComponent 的使用
我想在我的 Lwuit 应用程序中使用 PeerComponent 来使用本机 Blackberry 字段,如下例所示:
Player player = Manager.createPlayer("capture://video");
player.realize();
VideoControl vc = (VideoControl) player.getControl("VideoControl");
Field viewFinder = (Field) vc.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field");
player.start();
我的问题是我的项目是 java-me (不是 Blackberry)。使用本机 RIM 组件无法编译我的项目。我需要区分 Blackberry 设备和其他 Java 设备之间的情况,并且在 Blackberry 情况下使用字段,我该怎么办?可以使用 PeerComponent 吗?
I want to use a PeerComponent in my Lwuit application for using a native Blackberry Field like this example:
Player player = Manager.createPlayer("capture://video");
player.realize();
VideoControl vc = (VideoControl) player.getControl("VideoControl");
Field viewFinder = (Field) vc.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field");
player.start();
My problem is that my project is java-me (not Blackberry). Using a native RIM component don't compile my project. I need differentiate cases between Blackberry devices and other Java devices and in Blackberry case use a Field, How can I do? It's possible with a PeerComponent?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您使用由 GUI 构建器生成的新项目结构或像在资源编辑器中手动完成的那样,这应该非常容易。在新的项目结构中,应用程序的代码驻留在可移植 J2ME 库项目中,RIM/J2ME/J2SE/Android 特定代码驻留在仅包含该库的单独项目中。
完成此操作后,您可以定义一个接口来调用通用接口,您只需针对特定于平台的代码以不同的方式实现该接口即可。
或者,您始终可以使用预处理器和目标,例如 Netbeans 允许的目标,我知道 Eclipse 的移动插件也有类似的功能。
If you are using the new project structure generated by the GUI builder or manually as is done in the resource editor this should be very easy. In the new project structure the code of your application resides in a portable J2ME library project, the RIM/J2ME/J2SE/Android specific code resides in a separate project that just includes the library.
Once you do that you can define an interface to invoke a generic interface which you just implement differently for the platform specific code.
Alternatively you can always use a pre-processor and targets such as Netbeans allows, I understand Eclipse's mobile plugin has a similar facility as well.