在 Blackberry 中通过 java 连接到 URL
我正在尝试通过 Blackberry 模拟器中的 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));
}
I am trying to connect to a URL through a Java program in Blackberry simulator. But it is not connecting.
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));
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试用这条线...
如果您尝试在模拟器中使用 deviceside=true
如果它是在移动设备上进行 wifi 连接,则必须使用 interface=wifi
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