简体   繁体   中英

Android Webview ERR_NAME_NOT_RESOLVED loading an URL

I have an App made using Android Webview , while using Wifi connection the initial page loaded displays ok, after switching to mobile data mode, the application shows the ERR_NAME_NOT_RESOLVED message at times.

Is there a workaround to hide this message until the page is correctly displayed? or to make it work when the connection is not good in the initial load?

Thanks for the insight.

You can ask the user to retry at that point of time either displaying there or by showing a popup with a message. If you get the network is strong enough load the same page again.

You can check the url that is getting loaded in your webview by doing this.

myWebView.setWebViewClient(new WebViewClient() {
    @SuppressLint("NewApi")
    @Override
    public void onPageFinished(WebView view, String url) {
        super.onPageFinished(view, url);
    }
    @Override
    public void onPageStarted(WebView view, String url, Bitmap favicon) {
        super.onPageStarted(view, url, favicon);    
    }
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM