File.DirAssets

dmtulsa

Member
Licensed User
Longtime User
As per the users guide:

4.3.2 Files
This window lists all the files that have been added to the project.
These files are saved in the Files.DirAssets folder.
These can be any kind of files: layouts, images, texts, etc.

In code how is File.DirAssets used? I have a pdf file added via the IDE. I need to retrieve the file (get its PATH) so I can send the path (somehow) to Adobe Reader.

sorry for all the posts. I know the File.DirAssets is described in the help viewer but there is no example.

Thanks
Doug
 

dmtulsa

Member
Licensed User
Longtime User
thanks you. 13.10 in the users guide basically says the same thing as the help viewer. There is no syntax example and it says very little about the file structure.

I'll just play around with with the file object to see how things work.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
A file is known by a path and a name.
Path can be:
- File.DirAssets
- File.DirInternal
- File.DirRootExternal
- etc.
Loading

As NJDude already showed for loading a bitmap:MyPicture = LoadBitmap(File.DirAssets, "SomePicture.png")
MyPicture = Bitmap
File.DirAssets = path
"SomePicture.png" = filename

You must be aware that files in any Android folder are not available directly by Windows.

Best regards.
 
Upvote 0

vb1992

Well-Known Member
Licensed User
Longtime User
" I have a pdf file added via the IDE."

If you included a PDF file in your app, then
you should first copy that PDF file to File.DirRootExternal

Then you can use Content Chooser to get the path to the file
 
Last edited:
Upvote 0

vb1992

Well-Known Member
Licensed User
Longtime User
"so I can send the path (somehow) to Adobe Reader."



Sub OpenPDF(FileName As String)
Dim i As Intent 'Requires a reference to the Phone library
i.Initialize(i.ACTION_VIEW, FileName)
i.SetType("application/pdf")
i.WrapAsIntentChooser("Choose PDF Viewer")
StartActivity(i)
End Sub
 
Upvote 0

dmtulsa

Member
Licensed User
Longtime User
Ok, thank you all.

I understand the android files are not available to windows. I'm just trying to get a grip on B4A's terminology. Every compiler has its own even thought it's still basic. The only way to learn is just to do it. I try to look at the documentation & samples first before I post something but I'll ask if I don't understand.

I see that B4A is pretty powerful and it will take time to learn the in's and out's.

Things like:

i.SetType("application/pdf")
i.WrapAsIntentChooser("Choose PDF Viewer")

How would I know the pass "Choose PDF Viewer" instead of "PDF Viewer" ?

It's hard to find things like that in the doc's. It just say's WrapAsIntentChooser (Title As String) How do I know what the title is? Its is things like this I need to learn.

So please bear with me for awhile until I get to know B4A a bit better.

Thank you again
 
Upvote 0
Top