0

1)我使用 LWUIT 制作了一个 J2ME 应用程序,我在其中访问互联网以从我的服务器获取信息.... 2)该应用程序完美连接到我在诺基亚、Android 手机上的服务器 3)但是当相同的应用程序运行时Blackberry ....I get NullPointer exception during httpconnection... 4) 代码片段如下

import javax.microedition.io.Connector;
import javax.microedition.io.HttpConnection;
StringBuffer b = new StringBuffer();
InputStream is = null;
private HttpConnection connection;
try
{
        connection=(HttpConnection) Connector.open("http://curiousinc.in/ipl4app/LiveMatch.txt");
    is = connection.openInputStream();
}

5) 现在为什么这段代码在 BB 上不起作用???.....我使用 netbeans & BB SDK v4.6 编译了 BB jar & cod 文件

4

3 回答 3

2

If you use the LWUIT4IO to connect to the internet, I can assure you that it will work regardless of platform.

I encountered the same issue - mine wouldn't work in Android and Blackberry. So I followed Shai Almog's instructions on the LWUIT Blog here and changed all my internet connections to this. Solved my issues immediately!

于 2011-12-21T19:39:23.940 回答
1

它不起作用,因为黑莓是特殊的,即不完全遵循规范。使用这个HttpConnection 工厂

于 2011-04-12T20:03:05.897 回答
1

请参阅开发人员知识库文章:什么是 - 建立 HTTP 或套接字连接的不同方法

于 2011-04-11T07:36:09.247 回答