Open pdf file programmatically in android

In this post we will see that how to open or read pdf file programmatically in android. If user open android app then pdf file will be open. First put your given pdf file in app\src\main\assets path .You can customise according to your need.

I have shown here with both option :

  1.  given pdf file will open after app open .
  2. when user click on custom button then given pdf file will be open.

AndroidManifest.xml :

MainActivity.java :

content_main.xml :

only button code snippet:

 

MainAcitivity Screen :

 

Open pdf file programmatically in android output
Open pdf file programmatically in android output

In this way you can open a pdf file in your app programmatically. If you have any doubt then comment below.

Leave a Reply

Your email address will not be published. Required fields are marked *

2 comments