2011-08-28 38 views
-1

我想通過黑莓模擬器中的Java程序連接到URL。但它並沒有連接。通過黑莓中的java連接到URL

try { 
     HttpConnection httpConn; 
     StreamConnection s; 
     s = (StreamConnection)Connector.open("http://www.google.com/"); 
     httpConn = (HttpConnection)s; 
     status = httpConn.getResponseCode(); 

    } catch (IOException e) { 
     // TODO Auto-generated catch block 
     e.printStackTrace(); 
    } 
    int t=0; 
    if (status == HttpConnection.HTTP_OK) 
    { 
     add(new RichTextField("Successfully Authorized", Field.NON_FOCUSABLE)); 
    } 
+0

有你開始了[MDS模擬器](http://docs.blackberry.com/en/developers/deliverables/5716/The_BB_MDS_Simulator_447180_11.jsp)? –

+0

好故事,兄弟。 –

回答

0
s = (StreamConnection)Connector.open("http://www.google.com"+";deviceside=true"); 

嘗試用這條線...... 如果您在仿真器試圖意味着使用裝置側=真 如果在WiFi連接的移動手段,你必須使用接口= wifi的