Android webview not loading/opening pdf

  • Replies:0
veera ravala
  • Forum posts: 1

Oct 15, 2022, 8:33:51 AM via Website

My webview is loading google chrome. When the user browses the webview app he can navigate to any links which is working fine. But when the user navigates to a link which contains pdf my webview fails to open or download the file. How can I achieve it?

public class WebViewPage extends AppCompatActivity {
WebView webView;
Button closeweb;

protected void onCreate(Bundle savedInstanceState) {

    webView =findViewById(;
    closeweb = findViewById(;
    WebSettings webSettings = webView.getSettings();

     webView.setWebViewClient(new WebViewClient());

    webView.loadUrl("any url");
     closeweb.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Intent intent = new Intent(WebViewPage.this, HomePage.class);

public void onBackPressed() {

Be the first to answer