I want to open a pdf file in app inventor

I didn't run companion.I install apk directly.

I try this apk but unfortunately after run for first time I closed it and when i wanted to run it for second time , the pdfs buttons were disabled and the app didn't show the pdfs.

I try this code but it shows only one pdf (him1) for each button I press.H found that in the storage/emulated/0/android/data/... there were on file with three name!

If you think this code works well please send me aia because I don't have TaifunFile extension.thanks.

If you know that this code works well please send me aia .Working with all android version is best.

Thank you all and I hope you solve my problem..

From the example I posted here:

To answer your questions:

image

The list is generated from the csv row in text, of the three pdf files in the assets.

The ASD is the application specific directory, a directory location you can save files in your app, and to be able to (easily) read and write with them. It can be more difficult if you move them elsewhere. You can access the file path to the ASD using these blocks with the file component, or directly with the ViewPDF extension

image

the path will look something like this:

/storage/emulated/0/Adnroid/data/<package_name>/files

Some basics on Android storage system

Yes, just move the blocks for Button2 to the Screen1.Initialise block

Try this one (works with Companion & APK):
View3PDFsFromASD.aia (2.1 MB)

Okay.Thanks very much.But why your app shows pdfs just once?After running again the buttons are disabled.

Thank you very much.If I want to add some pdfs to app Should I change anything?

Sorry, too many double negatives....

Try this in your Screen1.Initialise instead:

Of course, it must be changed. It is better to ask the question as follows: If I upload one or more other files in the same code and change the necessary parts on the code, does the code work correctly? Is there a need to change somewhere outside the code? is not?

Mine is a simple example to get you started....

If you want to add another file in the assets, then include the filename in the csv row.
Then add another button to load the pdf in the viewer.

That's all you need to pick and open each PDF file that is in the assets:

Excuse me .What is the code of "absolutePath" procedure?
Capture2
My guess is I must remove pdf_2.pdf and replace "Listpicker1.selection".Is it true? :blush:Or "Get Item"?I think second is true.

you can use also this block

Exactly, why don't you just give it a try?

1 Like

Note:

Thanks very very very much everybody help me and teach me many things specially ANKE,TIMAI2 and Patel and others .I'm sorry I took your time. Of course, I'm at the beginning of the programming path and I will definitely bother you again. Maybe very quickly! You will surely accept my excuse. Goodbye for now, of course, maybe for a few hours!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.