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
精彩评论