2

I'm trying to simply open a PDF from my application when a certain button is clicked by checking if the user has Adobe Reader installed, and if they do, then to open the PDF using Adobe Reader. I'm pretty sure this is possible, but I'm a little lost as to how I would accomplish this. Help would really be appreciated!

CustardBun
  • 3,457
  • 8
  • 39
  • 65
  • Probably a duplicate of this: http://stackoverflow.com/questions/2784847/how-do-i-determine-if-android-can-handle-pdf – Earl Aug 16 '11 at 22:51

1 Answers1

2

Basically you can do this by launching pdfreader from your application.Check the following code for that.

             Intent intent = new Intent(Intent.ACTION_VIEW);
             intent.setDataAndType(path,"application/pdf");
             intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

             try {
                 startActivity(intent);
             } 
             catch (ActivityNotFoundException e) {
                 Toast.makeText(OpenPDFNew.this, "NO PDF Viewer is available,Please Download it from Market ", Toast.LENGTH_LONG).show();
             }

where path is nothing but actual path for your pdf file.Hope this will help you.

The iCoder
  • 1,414
  • 3
  • 19
  • 39