连接WAP网站,为什么连不起?请指教
主MIDLET
package http;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import javax.microedition.lcdui.*;
public class http extends MIDlet {
Display display;
lianjie l;
public http() {
display=Display.getDisplay(this);
l=new lianjie();
// TODO Auto-generated constructor stub
}
protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
// TODO Auto-generated method stub
}
protected void pauseApp() {
// TODO Auto-generated method stub
}
protected void startApp() throws MIDletStateChangeException {
new Thread(l).start();
}
}
HTTP类
package http;
import javax.microedition.io.*;
public class lianjie implements Runnable {
HttpConnection conn;
public lianjie()
{
}
public void run()
{
try
{
conn=(HttpConnection)Connector.open( "http://wap.wapcn.net/ ");
}catch(Exception e){}
}
}
显示连接要收取数据费,点OK,后,没显示
为什么?我环境问题?
------解决方案--------------------当然没有显示啦,你只是打开了连接,还要把数据读过来,淡然,有这些还是不够的,你还要能解析你读过来的WML,自己去显示...