how to get html content from a webview?

后端 未结 12 1562
鱼传尺愫
鱼传尺愫 2020-11-22 04:29

Which is the simplest method to get html code from a webview? I have tried several methods from stackoverflow and google, but can\'t find an exact method. Please mention an

12条回答
  •  -上瘾入骨i
    2020-11-22 04:58

    try using HttpClient as Sephy said:

    public String getHtml(String url) {
        HttpClient vClient = new DefaultHttpClient();
        HttpGet vGet = new HttpGet(url);
        String response = "";    
    
        try {
            ResponseHandler vHandler = new BasicResponseHandler();
            response = vClient.execute(vGet, vHandler);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return response;
    }
    

提交回复
热议问题