每个支持JavaME的移动制造商都需要跨设备的-
特别是:当应用程序打开时,它重定向到移动设备的默认浏览器中的(电缆)链接。
找到了如何在而不是移动Java应用程序中这样做,但是还没有找到JavaME的例子。
我正在使用JavaME和SunJavaWirelessToolKit2.5.2和eclipseME。
编辑:我正在尝试:
try {
platformRequest("http://www.stackoverflow.com");
destroyApp(true);
notifyDestroyed();
} catch (ConnectionNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}但不确定它是否能在所有平台上运行。另外,为什么应用程序必须被销毁?
发布于 2012-02-24 20:18:59
好吧,这就是为什么,请阅读代码的评论:
// In startApp()
boolean mustExit = false;
try {
/**
* mustExit - Boolean
*
* Some MIDP platforms are more restricted than others.
* For example, some don't support concurrent processing,
* so the MIDlet must exit before the platform can honor
* a service request.
*
* If <true> destroy the app. So the browser
* can start.
*/
mustExit = platformRequest("http://www.stackoverflow.com");
} catch (ConnectionNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if(mustExit){
destroyApp(true);
notifyDestroyed();
}此外,如果您在Linux下,则必须为模拟器设置默认浏览器。转到yourPath/Java/lib/system.config,在末尾添加以下行:
# Associate the Mozilla browser with platformRequest() - Linux
com.sun.midp.midlet.platformRequestCommand: /usr/bin/firefox(当然可能是另一个浏览器)
现在在您的emulator.Or中运行它,创建.jad和.jar,在物理电话中运行它。
https://stackoverflow.com/questions/9402247
复制相似问题