开发者

web page not available error

开发者 https://www.devze.com 2023-03-08 18:29 出处:网络
private class HelloWebViewClient extends WebViewClient { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) {
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

精彩评论

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

关注公众号