title: stop loading in webViewClient
body: <p>In my WebView, I have multiple links in header. In Offline mode, I mustn't allow reload the page and keep that page as is and then, inform users about internet connection. I am able to catch links before it loads using <code>shouldOverrideUrlLoading</code> if I click other links. But if I click the same link, <code>shouldOverrideUrlLoading</code> is not being fired, instead, <code>onLoadResource</code> method is being called first. In that method I tried <code>webView.stopLoading();</code> but it continues working and fire <code>onReceivedError</code> method and shows error report on the page. </p>
  
  <p>Here is my WebClient:</p>
  
  <pre><code>webView.setWebViewClient(new WebViewClient() {
  
          @Override
          public boolean shouldOverrideUrlLoading(WebView view, String url) {
              if(MyApplication.getInstance().isOnline()) {
                  return false;
              }
  
              Toast.makeText(getApplicationContext(), "Please check Internet connection and try again.", Toast.LENGTH_SHORT).show();
              return true;
          }
  
          @Override
          public void onPageStarted(WebView view, String url, Bitmap favicon) {
              Log.i("ON_PAGE_START", "RUNNING ============&gt;" + url);
              if (MyApplication.getInstance().isOnline()) {
                  super.onPageStarted(view, url, favicon);
              } else {
                  webView.stopLoading();
              }
          }
  
          @Override
          public void onLoadResource(WebView view, String url) { 
  
              if (MyApplication.getInstance().isOnline()) {
                  super.onLoadResource(view, url);
              } else {
                  webView.stopLoading();                  
              }
          }
  
          @Override
          public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {               
  
              view.stopLoading();
  
              Toast.makeText(getApplicationContext(), "Please check Internet connection and try again.", Toast.LENGTH_SHORT).show();
              super.onReceivedError(view, errorCode, description, failingUrl);    
          }
      });
  </code></pre>
  
  <p>What I want is to be able to ensure that urls are not being fired if it is offline and inform about that.</p>