0
I created an Arraylist list and wanted to open pdf files in it, but I am storing the pdf files in res/raw folder and when calling in String ("res/raw") the file just doesn’t open, which I do?
0
I created an Arraylist list and wanted to open pdf files in it, but I am storing the pdf files in res/raw folder and when calling in String ("res/raw") the file just doesn’t open, which I do?
Browser other questions tagged android pdf arraylist
You are not signed in. Login or sign up in order to post.
My suggestion is to use some library with good reputation to render the PDF, has a list available on android arsenal: https://android-arsenal.com/tag/72?sort=rating with various options.
– Wakim
Yes, but how to add the pdf in Array?
– Isabela Andrade
The ideal is for you to access Inputstream, using the
context.getResources().openRawResource(R.raw.nome_do_pdf)
. Do you want to open all Arrayslist Pdfs at the same time or just one at a time? I recommend looking at the library documentation, how it expects you to pass the PDF to it to render, because it can vary a lot.– Wakim
I want to open a different pdf for each click of the Array, the problem is that when I click on the list item, the pedf does not appear, it simply appears a white screen.
– Isabela Andrade
Look I put it this way to access:New Pdfview = (Pdfview) findViewById(pdfView); new.fromAsset("text.pdf"). load();
– Isabela Andrade
But it shows a blank screen and in the log appears the following message:05-19 16:47:44.637 23878-23878/com.example.android.contos V/Activitythread: updateVisibility : Activityrecord{4ca7407 token=android.os.Binderproxy@c 905bfe {com.example.android.contos/com.example.android.contos.Mainactivity}} show : false
– Isabela Andrade
This error doesn’t help much, it would be good to tell which lib is using, and shouldn’t pass the Resource id instead of a String?
– Wakim
I got Wakim, know what it was, I was putting in the raw folder, just change the pdf file to the Assets folder and put it in the main folder, which worked, will understand!
– Isabela Andrade
Cool, I thought inside raw would also work :( Could include an answer with this adjustment.
– Wakim