B4J Question [Solved] Add files/sub directories to app

Mark Read

Well-Known Member
Licensed User
Longtime User
I have a series of image files (422 of them, 10MB) which I need to include in my app. What is the best way to do this? They are organised in a series of sub directories.

Many thanks.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Create a zip file with a folder named Files. Copy all the folders into the Files folder (in the zip file).

Rename the zip file extension to jar.
Copy it to the additional libraries folder and reference it with: #AdditionalJar: myimages

You can now access the files with:
B4X:
fx.LoadImage(File.DirAssets, "test/smiley.png") 'test is a folder under the Files folder in the jar.
 
Upvote 0

Mark Read

Well-Known Member
Licensed User
Longtime User
Brilliant Erel!! Maybe worth moving this thread to code snippets? Many thanks.
 
Upvote 0

Mark Read

Well-Known Member
Licensed User
Longtime User
Forgot that the "\" doesn't work in the filename. Changed it to "/" and everything works great. :D
 
Upvote 0
Top