title: Can not open PDF file using WebView
body: <p>I was trying to show pdf file using a url in webview. Although the webview is oading webpage like google.com, it does not load anything or throw any exception when I try to load the url of the pdf.</p>
  <p>The url loads pdf in google chrome desktop browser, so I guess the problem is not with the url itself.</p>
  <p>Here's what I've coded so far:</p>
  <p><strong><code>onCreateView()</code> of Fragment that loads the pdf</strong></p>
  <pre class="lang-java prettyprint-override"><code>    @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
          // Inflate the layout for this fragment
          View view = inflater.inflate(R.layout.fragment_brochure, container, false);
          webView = view.findViewById(R.id.webView);
  //        webView.loadUrl(&quot;https://google.com&quot;);
          webView.loadUrl(&quot;https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf&quot;);
  //        webView.loadUrl(brochureUrl);
          // Enable Javascript
          WebSettings webSettings = webView.getSettings();
          webSettings.setJavaScriptEnabled(true);
          webSettings.setSupportZoom(true);
  
          // Force links and redirects to open in the WebView instead of in a browser
          webView.setWebViewClient(new WebViewClient());
          return view;
      }
  </code></pre>
  <p><strong>Layout (xml file):</strong></p>
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;LinearLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;
      android:orientation=&quot;vertical&quot;
      android:background=&quot;@color/purple_500&quot;
      tools:context=&quot;.ui.project_details.project_details_pages.BrochureFragment&quot;&gt;
  
      &lt;WebView
          android:id=&quot;@+id/webView&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:layout_marginTop=&quot;28dp&quot;/&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  <p><strong>Manifest file (only the portion that I think to be relavant)</strong></p>
  <pre class="lang-xml prettyprint-override"><code>    &lt;uses-permission android:name=&quot;android.permission.ACCESS_NETWORK_STATE&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.INTERNET&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.READ_EXTERNAL_STORAGE&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.WRITE_EXTERNAL_STORAGE&quot; /&gt;
  
      &lt;application
          android:allowBackup=&quot;true&quot;
          ...
          ...
          ...
          android:supportsRtl=&quot;true&quot;
          android:usesCleartextTraffic=&quot;true&quot;&gt;
  </code></pre>
  <p>I would like to know what I'm missing. Also, it would be great if I could learn how to debug this type of issues.</p>