Opening pdf file from server using android intent

前端 未结 4 1513
孤街浪徒
孤街浪徒 2020-12-05 12:09

I\'m searching on the web how to open pdf file from server with default pdf viewer on android. What I found is download the file first then start it in intent or load it wit

4条回答
  •  自闭症患者
    2020-12-05 12:55

    You can try this using WebView:

    public class MyPdfViewActivity extends Activity {
    
      @Override
      protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        WebView mWebView=new WebView(MyPdfViewActivity.this);
        mWebView.getSettings().setJavaScriptEnabled(true);
        mWebView.getSettings().setPluginsEnabled(true);
        mWebView.loadUrl("https://docs.google.com/gview?embedded=true&url="+LinkTo);
        setContentView(mWebView);
      }
    }
    

提交回复
热议问题