title: how to add custom webview client to android activity
body: <p>I have the following simple activity:</p>
  
  <pre><code>@Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          wv = (WebView) findViewById(R.id.webview);
  
          wv.setWebChromeClient(new CustomWebViewClient());
  }
  </code></pre>
  
  <p>I found the following code snippet for a custom webclient and want to use it in the above activity:</p>
  
  <pre><code>private class CustomWebViewClient extends WebViewClient {
          @Override
          public boolean shouldOverrideUrlLoading(WebView view, String url) {
              if(url.contains("mysite.com")) {
                  view.loadUrl(url);
              } else {
                  Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
                  startActivity(i);
              }
              return true;
          }
      }
  </code></pre>
  
  <p>I get the error:</p>
  
  <blockquote>
    <p>Error:(53, 11) error: method setWebChromeClient in class WebView
    cannot be applied to given types; required: WebChromeClient found:
    MainActivity.CustomWebViewClient reason: actual argument
    MainActivity.CustomWebViewClient cannot be converted to
    WebChromeClient by method invocation conversion</p>
  </blockquote>
  
  <p>What am I doing wrong?</p>