0 0

j2me 联网死机3


//sps类 实现了 Runnable调用run会调用 getHttp方法

private String getHttp(String url)
    {
        System.out.println("getHttp:"+url);
        String re = "";
        try{
            HttpConnection httpConn = (HttpConnection)Connector.open(url);
            System.out.println("getCode:"+httpConn.getResponseCode());
            InputStream isStrm = httpConn.openInputStream();
            DataInputStream in = new DataInputStream(isStrm);
            
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            int ch;
            while ((ch = in.read()) != -1) {
                baos.write(ch);
            }
            byte[] bstr = baos.toByteArray();
            re = new String(bstr);
        } catch (Exception e){
            System.out.println(e.toString());
            e.printStackTrace();
        }
        return re;
    }





//在一个ui类( extends Canvas)中的keyPressed方法中会调用这个方法

void th()
    {
        try{
            Thread iniTh = new Thread(sps);
            iniTh.start();
            iniTh.join();
        } catch (Exception e){
            e.printStackTrace();
        }
    }



结果导致  System.out.println("getCode:"+httpConn.getResponseCode());这里没输出

程序在这里死掉了
请问哈 可能是什么问题
怎么办?
2011年4月06日 18:12
目前还没有答案

相关推荐

Global site tag (gtag.js) - Google Analytics