Open online pdf file through android intent?

前端 未结 12 1515
醉话见心
醉话见心 2020-12-04 21:53

Currently I have a pdf url, and I would like to simply using the intent to open it, however, it does not work if I put the url in intent

12条回答
  •  一生所求
    2020-12-04 22:52

    you can try this. it works for both .pdf and .docx

     String pdfUrl = "abc.pdf"; //
     String url = "http://docs.google.com/gview?embedded=true&url=" + pdfUrl;
    
     WebView webView = findViewById(R.id.webview_cv_viewer);
     webView.getSettings().setSupportZoom(true);
     webView.getSettings().setJavaScriptEnabled(true);
     webView.loadUrl(url);
    

提交回复
热议问题