开发者

LWUIT httpconnection not working on Blackberry

1) I made a J2ME app using LWUIT in which I am accessing internet to get info from my server.... 2) The app is perfectly connecting to my sever on Nokia, Android handsets 3) But when the same app is run on Blackberry ....I get NullPointer exception during httpconnection... 4) The code snippet is as follows

import javax.microedition.io.Connector;
import javax.microedition.io.HttpConnection;
StringBuffer b = new StringBuffer();
I开发者_如何学CnputStream is = null;
private HttpConnection connection;
try
{
        connection=(HttpConnection) Connector.open("http://curiousinc.in/ipl4app/LiveMatch.txt");
    is = connection.openInputStream();
}

5) Now why is this code not working on BB???.....I compiled BB jar & cod file using netbeans & BB SDK v4.6


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!


See the Developer Knowledge Base article: What Is - Different ways to make an HTTP or socket connection


It does not work because Blackberry is special, i.e. does not entirely follow the norm. Use this HttpConnection factory.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜