Android : Loading the pdf within the application on Android with PdfRenderer - how to locate the file?

on Thursday, January 29, 2015


I would like to use PdfRenderer to display the myDoc.pdf within the application:



File file = new File("/sdcard/Download/myDoc.pdf");
PdfRenderer renderer
= new PdfRenderer(ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY));
...


The problem is, I want to include the myDoc.pdf in the application rather then assuming it's under /sdcard/Download/ or on some website.


How can I include the myDoc.pdf in the application and how the path to it should looks like in the code?


I use Android Studio and I assume the /res should be somehow associated with such files.


0 comments:

Post a Comment