title: android webview pdf viewing
body: <p>im building an app that should allow users to click a link to a pdf document in a webview and display it in the view. im using google docs viewing pdf files work, but my problem is that i only want the method to work for pdf links and not every link, heres my code:</p>
  
  <pre><code>public class HelloWebViewActivity extends Activity 
  {
  WebView mWebView;
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) 
  {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
  
      mWebView = (WebView) findViewById(R.id.webview);
      mWebView.getSettings().setJavaScriptEnabled(true);
      mWebView.loadUrl("https://nuigalway.blackboard.com/webapps/login/");
      mWebView.setWebViewClient(new HelloWebViewClient());
  
  }
  
  private class HelloWebViewClient extends WebViewClient 
  {
      @Override
      public boolean shouldOverrideUrlLoading(WebView view, String url)
      {
          String googleDocs = "https://docs.google.com/viewer?url="; 
          mWebView.loadUrl(googleDocs + url);
          return true;
      }
  }
  
  @Override
  public boolean onKeyDown(int keyCode, KeyEvent event)
  {
      if ((keyCode == KeyEvent.KEYCODE_BACK) &amp;&amp; mWebView.canGoBack())
      {
          mWebView.goBack();
          return true;
      }
      return super.onKeyDown(keyCode, event);
  }
  
  }
  </code></pre>
  
  <p>i think the error is in the shouldOverrideUrlLoading method. Is there any method that would allow me to open the pdf url only when the file itself is clicked in the webview?</p>