0

Hi I am using below codes to display pdf file from url. but It gives an error " whoops this file is too big to preview" and my pdf file is not opening. is there any way to escape this error thanks alot:

 super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_giris);
  /*  webview = (WebView)findViewById(R.id.webview);
    progressbar = (ProgressBar) findViewById(R.id.progressbar);
    webview.getSettings().setJavaScriptEnabled(true);
 String filename ="https://xxxxx.files.wordpress.com/2014/01/xxxx-pdf.pdf";
    webview.loadUrl("http://docs.google.com/gview?embedded=true&url=" + filename);

    webview.setWebViewClient(new WebViewClient() {

        public void onPageFinished(WebView view, String url) {
            // do your stuff here
            progressbar.setVisibility(View.GONE);
        }
    });*/
    File file = new File(Environment.getExternalStorageDirectory(), "Report.pdf");
    Uri path = Uri.fromFile(file);
    Intent pdfOpenintent = new Intent(Intent.ACTION_VIEW);
    pdfOpenintent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    pdfOpenintent.setDataAndType(path, "https://xxxx.files.wordpress.com/2014/01/xxxx-pdf.pdf");
    try {
        startActivity(pdfOpenintent);
    } catch (ActivityNotFoundException e) {

    }}}
e.zver
  • 31
  • 5

0 Answers0