参数从WebView传递到Activity

时间:2015-08-11 07:02:11

标签: android webview

我必须将网页从etcd.conf调用到WebView。这是我希望在ActivityActivity中加载的网页之间实现的双向通信

修改

WebView

2 个答案:

答案 0 :(得分:0)

看看:http://developer.android.com/guide/webapps/webview.html

只需在里面创建一个包含webview的活动并加载URL。

答案 1 :(得分:0)

扩展WebViewCLient(示例来自教程):

private class MyWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
    if (Uri.parse(url).getHost().equals("www.example.com")) {
        // This is my web site, so do not override; let my WebView load the page
        return false;
    }
    // Otherwise, the link is not for a page on my site, so launch another Activity that handles URLs
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    startActivity(intent);
    return true;
}

}