为什么用视频里的代码打结果什么页面都没有

什么报错都没有就是一片空白,代码明明和视频中的一样
public class HttpThread extends Thread {
    private String urlString;
    private Handler handler;
    private WebView view;



    public HttpThread(String urlString, Handler handler, WebView view) {
        super();
        this.urlString = urlString;
        this.handler = handler;
        this.view = view;
    }

    @Override
    public void run() {
        // TODO Auto-generated method stub
        try {
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection)url.openConnection();
            connection.setReadTimeout(5000);
            connection.setRequestMethod("GET");
            BufferedReader bReader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
            final StringBuffer sBuffer= new StringBuffer();
            String string;
            if((string = bReader.readLine()) != null){
                sBuffer.append(string);
                Log.i("sz", string);
            }
            handler.post(new Runnable() {
                
                @Override
                public void run() {
                    // TODO Auto-generated method stub
                    view.loadData(sBuffer.toString(), "text/html; charset=gb2312", null);
                }
            });
        } catch (MalformedURLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

}


weibo_黄前同学_0
浏览 1657回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP