I'm having problems with PDFRenderer
not changing the PDF it shows after the first run of the application, no matter what I do.
I'm using the code from the official PDFRenderer Sample from https://developer.android.com/samples/PdfRendererBasic/project.html and Android Studio.
Exact steps I take which can be used to replicate this:
- Add 2 files to
Application/src/main/assets
:PDF_1.pdf
andPDF_2.pdf
In
PdfRendererBasicFragment.java
, line 140 in function openRenderer, changemFileDescriptor = context.getAssets().openFd("sample.pdf").getParcelFileDescriptor();
to
mFileDescriptor = context.getAssets().openFd("PDF_1.pdf").getParcelFileDescriptor();
Run project; Everything works as expected
- In code above, change
"PDF_1.pdf"
to"PDF_2.pdf"
- Run project again; The application still shows PDF_1.pdf
I have tried starting a completely new emulator, removing PDF_1.pdf from assets folder, syncronizing assets and "clean / rebuild project" in Android Studio , but it still keeps displaying PDF_1.pdf after the first run.