开发者

web page not available error

private class HelloWebViewClient extends WebViewClient {
    @Override

    public boolean shouldOverrideUrlLoading(WebView view, String url) {
        view.loadUrl(url);
    return true;
    }
}

WebView w=(WebView) dialog.findViewById(R.id.webView);
WebView.enablePlatformNotifications();
w.getSettings().setJavaScriptEnabled(true); 
w. getSettings().setJavaScriptCanOpenWindowsAutomatically (false);
w. getSettings().setPluginsEnabled (true);
w.loadUrl("http://www.agaraadhi.com");
w.setWebViewClient(new HelloWebViewClient());

I'm trying to load a web page into the web view.I get web page not available error.I can access the page from the default browser.I set the permission in manifest.开发者_开发问答But the below code works fine.

Uri uri = Uri.parse("http://www.agaraadhi.com");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);


Do you have the permission android.permission.INTERNET enabled in AndroidManifest.xml? E.g.

<uses-permission android:name="android.permission.INTERNET"/>

Regarding one of the comments above, I haven't heard of WebViews requiring the ACCESS_NETWORK_STATE permission, and have had them working without it, but perhaps the functionality is automatically used for something optional if available(?)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜