4

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.

CoderRoller
  • 1,239
  • 3
  • 22
  • 39
  • Possible duplicate of [How to edit or create custom error page for WebView?](http://stackoverflow.com/questions/4101331/how-to-edit-or-create-custom-error-page-for-webview) – PurkkaKoodari Oct 22 '15 at 07:46
  • I dont want to hide the message only but to hold to it until the signal is strong and the page is loaded, see the edit. – CoderRoller Oct 22 '15 at 08:08

2 Answers2

0

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.

Jarvis
  • 503
  • 2
  • 5
  • 17
-1

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);    
    }
});
PurkkaKoodari
  • 6,703
  • 6
  • 37
  • 58
Ravneet Singh
  • 213
  • 1
  • 13
  • 2
    Can you elaborate a bit more please?. Check the URL for what purpose?, i already know the URL that I am loading. – CoderRoller Oct 22 '15 at 08:10