Flyingkiwi Flyingkiwi - 1 year ago 60
Java Question

Simple questions regarding integrating Android PDF Library

I am trying to integrate this into my app:

I am just looking for an expansion on the readme from about step four as I new to Java and don't fully understand what is required.

  • (Step four) Do I just need to add to my "src/"?

  • (Step five) Where to I put the default drawables and layout settings, the same same place I call the intent intent?

  • Is the path to my assets folder simply... "/assets/something.pdf"

  • What do I need to add to my manifest.xml manifest.xml?

Answer Source

Seeing as you have added the JAR to your build path you can just extend the class given. Assuming you import the appropriate files in your imports.

public class myPdfActivity extends PdfViewerActivity
    //Do something with your activity.

The default drawables would go in your class I've just defined above for you. When it comes to drawing the particular parts of the PDF view you the code will call something like myPdfActivity.getZoomOutImageResource() to get the zoom out image. This means you can override the method to replace it with your own custom zoom out image.

public class myPdfActivity extends PdfViewerActivity
     public int getPreviousPageImageResource() { return R.drawable.left_arrow; }
     public int getNextPageImageResource() { return R.drawable.right_arrow; }
     public int getZoomInImageResource() { return R.drawable.zoom_in; }
     public int getZoomOutImageResource() { return R.drawable.zoom_out; }
     public int getPdfPasswordLayoutResource() { return R.layout.pdf_file_password; }
     public int getPdfPageNumberResource() { return R.layout.dialog_pagenumber; }
     public int getPdfPasswordEditField() { return; }
     public int getPdfPasswordOkButton() { return; }
     public int getPdfPasswordExitButton() { return; }
     public int getPdfPageNumberEditField() { return; }

Your manifest might need permissions to access the file system or to read files, I'm not too good with permissions so maybe someone else can give you a better answer on this one.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download