title: My WebView does not finish loading
body: <p>Hi I have totally no idea why my webview is not call the onPageFinished method, and the it was showing the loading dialog all the time, I hope there is someone out there help me for my this issue. In the Android manifest file I already put the internet permission and also the network access state.</p>
  
  <p>so this is my code:</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
  
      WebView mWebView;
      RelativeLayout rLoading;
      Map&lt;String, String&gt; header;
  
      String urlToLoad;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          mWebView = (WebView) findViewById(R.id.webView);
          rLoading = (RelativeLayout) findViewById(R.id.loading);
  
          if ( isNetworkAvailable() == true )     //check if internet available or not
          {
              mWebView.setFocusable(true);
              mWebView.setFocusableInTouchMode(true);
              mWebView.getSettings().setJavaScriptEnabled(true);
              mWebView.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
              mWebView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
              mWebView.getSettings().setDomStorageEnabled(true);
              mWebView.getSettings().setDatabaseEnabled(true);
              mWebView.getSettings().setAppCacheEnabled(true);
              mWebView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
              mWebView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
  
              urlToLoad = "https://www.google.com/";
  
              UsernamePasswordCredentials creds= new UsernamePasswordCredentials("username", "password");
              Header credHeader = BasicScheme.authenticate(creds, "UTF-8", true);
              header = new HashMap&lt;String, String&gt;();
              header.put(credHeader.getName(), credHeader.getValue());
              //show loading dialog
              mWebView.loadUrl(urlToLoad, header);
              mWebView.setWebViewClient(new WebViewClient(){
                  public void onPageFinished(WebView view, String url) {
  
                          rLoading.setVisibility(View.GONE);
  
                  }
              });
          }
          else    //Not connected
          {
              Toast.makeText(
                      this,
                      "No internet connection",
                      Toast.LENGTH_LONG
              ).show();
          }
      }
  
      public boolean isNetworkAvailable() {
          ConnectivityManager connectivityMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
          NetworkInfo networkInfo = connectivityMgr.getActiveNetworkInfo();
          /// if no network is available networkInfo will be null
          if (networkInfo != null &amp;&amp; networkInfo.isConnected()) {
              return true;
          }
          return false;
      }
  
      @Override
      public void onBackPressed() {
          if(mWebView.canGoBack()){
              mWebView.goBack();
          }else {
              super.onBackPressed();
          }
      }
    }
  </code></pre>
  
  <p>Someone please help me</p>