适用于所有手机型号的 J2ME 通用 api
我是 J2ME 应用程序开发的新手。通常我使用模拟器(使用 Netbeans IDE)为诺基亚手机 s60 系列和 PC 开发 j2me 应用程序。我认为模拟器具有运行移动应用程序的诺基亚基础设施。
当我尝试在诺基亚手机、索尼爱立信、摩托罗拉手机上运行相同的简单 j2me 应用程序时,它不起作用。我听说 j2me api 与手机供应商略有不同。我是否必须使用索尼爱立信和摩托罗拉 J2ME API 并为每个品牌开发单独的应用程序?我不能对所有手机使用通用的 J2ME api 吗?或者任何为所有手机使用通用 API 的解决方案。 (应用功能可以限制手机的性能、版本、系列及其支持。没关系。这里我的问题是关于一个通用的api。我的问题可能类似于我们能否开发一个适用于所有移动设备的 j2me 应用程序。但我不能没找到好的 回答。)
I am new to J2ME application development. Normally I have developed j2me apps for Nokia phone s60 series and in PC using emulator(with Netbeans IDE). I think that emulator has Nokia infrastructures to run mobile apps.
When I tried to run the same simple j2me application which ran on a Nokia phone, on a Sony Ericson, Motorola, it did not work. I have heard that j2me apis are little bit different phone Vendor to Vendor. Will I have to use Sony Ericson and Motorola J2ME API and develop separate app for each brand? Cannot I use a common J2ME api for all mobile phones? Or any solutions to use a common api for all mobile phones. (The application features can be limited to the phone's performance, version, series and its support. It is ok. Here my question is about a common api. My question may be similar to can we develop a j2me application that work in all mobile devices. But I couldn't find good answer.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只要您使用严格属于 J2ME 框架一部分的包,您就不应该遇到任何问题。但是,您需要留意手机支持的 MIDP 和 CLDC 版本。
不同的 MIDP 和 CLDC 版本为您提供不同的 api,在不支持 MIDP 2.0 的东西上运行一段为 MIDP 2.0 设计的代码最终会导致错误。也许这个 Oracle Page 会帮助您解决任何问题您可能有的疑问。
As long as you used packages which are strictly part of the J2ME Framework you should not have any issues. You need however, to keep an eye out for the MIDP and CLDC version that the phone supports.
Different MIDP and CLDC versions provide you with different apis, running a piece of code designed for MIDP 2.0 on something which does not support it will eventually cause errors. Maybe this Oracle Page will help you solve any queries you might have.
查看 J2MEPolish。这是一个非常大的库,应该在应用程序开发人员和具体平台之间提供抽象级别。但需要一些时间来学习它。可能更简单的方法是参考具体的电话文档并仅使用具体模型支持的 JSR。有一个技巧可以让您检查是否支持具体的 JSR。您可以为特定 JSR 中的某些类调用
Class.forName()
。如果抛出异常,则不支持 JSR。 J2MEPolish 的优点是它可以帮助您生成每种设备类型的版本。Take a look on J2MEPolish. This is very large library that should provide level of abstraction between the application developer and the concrete platform. But it takes some time to learn it. Probably easier way is just to refer to the concrete phone documentation and use only JSRs that are supported by concrete model. There is a trick that allows you to check that concrete JSR is supported. You can call
Class.forName()
for some class from specific JSR. If exception is thrown JSR is not supported. The advantage of J2MEPolish is that it helps you to generate version per device type.