开发者

Connecting To a URL through java in Blackberry

I am trying to connect to a URL through a Java program in Blackberry simulator. But it is not connecting.

   try { 
        HttpConnection httpConn;
  开发者_Python百科      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));
    }


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

try with this line... If you are trying in emulator means use deviceside=true If its in a mobile means for wifi connection you have to use interface=wifi

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜