Android Question Is it possible to open a PDF without Intent?

Alex_197

Well-Known Member
Licensed User
Longtime User
Hi all.
Is it possible to open a PDF without Intent?

I know how to open a pdf file with intent - it works fine. But I have no control over it. What if the user diesn't have any apps installed to read pdf files? Next - how to get back from the intent to the app? Click Back button is not alwaus the option. For example - Microsoft PDF reader. We open a file with this app, then clicked Back and now we can see a list of other files. It might confuse a user if he is not tech savvy. I can't tell him what PDF reader to install.

My goal is to open a pdf so the user can see what inside (just to make sure that he opened a correct file). For example he has a pdf with his driver license and some other pdf files. And I need his driver license to be sent to the server and stored in his profile.

My idea:

1. user selects pdf
2. user sees that this is correct pdf
3. user clicks on the button Conformed and Send on the same screen

Thank you.
 
Use your own PDF reader like PDFab - a default PDF viewer app based on DonManfred's PDFium wrap and adapt it to your own behavior wishes.
Thank you for your reply.

I tried on my LGE LM-Q720 (Android 10) and it crashed.


B4X: Copy
** Activity (main) Pause, UserClosed = false **
** Activity (main) Create  **
** Activity (main) Resume **
onError()
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/util/ArrayMap;
    at com.shockwave.pdfium.PdfDocument.<init>(PdfDocument.java:109)
    at com.shockwave.pdfium.PdfiumCore.newDocument(PdfiumCore.java:132)
    at com.github.barteksc.pdfviewer.source.FileSource.createDocument(FileSource.java:38)
    at com.github.barteksc.pdfviewer.DecodingAsyncTask.doInBackground(DecodingAsyncTask.java:49)
    at com.github.barteksc.pdfviewer.DecodingAsyncTask.doInBackground(DecodingAsyncTask.java:25)
    at android.os.AsyncTask$3.call(AsyncTask.java:378)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    at java.lang.Thread.run(Thread.java:919)
Caused by: java.lang.ClassNotFoundException: android.support.v4.util.ArrayMap
    ... 10 more
** Activity (main) Pause, UserClosed = false **
 
Upvote 0
Back
Top