2012-02-22 171 views
0

需要被跨设备 - 工作对于每个手机制造商,让支持的JavaME -如何使用JavaMe在默认浏览器中打开链接?

特别是:当应用程序打开时,它重定向到在移动的默认浏览器(有线)链路设备。

找到如何做到这一点的移动Java应用程序,但没有发现例如用于的JavaME

我正在使用JavaME和Sun Java Wireless Tool Kit 2.5.2以及eclipseME。

编辑: 我试图做的事:

 try { 
     platformRequest("http://www.stackoverflow.com"); 
     destroyApp(true); 
     notifyDestroyed(); 
    } catch (ConnectionNotFoundException e) { 
     // TODO Auto-generated catch block 
     e.printStackTrace(); 
    } 

但不能肯定是否会在所有的平台上工作。另外,为什么应用程序必须销毁?

回答

2

那么,这是怎么回事,请阅读代码的注释:

  // 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。罐子运行它在你的身体的电话。

相关问题