开发者

Retrieve webview content

I need to retrieve the content of a WebView object. I have tried to no avail to get HttpPost or Get to work (can post that elsewhere).

开发者_StackOverflow社区 I simply want the html as text (see the attempt below - something in load_result should convert it to a String).

eg.

webview = (WebView) findViewById(R.id.webView1);
webview.loadUrl("http://www.dummy.com");

webview.setWebViewClient(new WebViewClient() {
    // implement your own web view client
    public void onPageFinished(WebView view, String url) {
        load_result();
    }
});

void load_result(){
    String result;

    webview = (WebView) findViewById(R.id.webView1);
    result = new String(webview.toString()); 
}

Any help would be highly appreciated!


Take a look at this: http://lexandera.com/2009/01/extracting-html-from-a-webview/

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜