B4J Code Snippet How to include many files into app without using files manager.

My aim was to include a lot of image files saved in directories in my app. Adding the files with the files manager tab was not of interest, as I had over 400 files. This solution comes from Erel and I am adding it here because its so simple and neat!

Original thread: https://www.b4x.com/android/forum/threads/add-files-sub-directories-to-app.80818/#post-512136

Solution:

1. Create a zip file with a folder named Files. Copy all the folders into the Files folder (in the zip file).

2. Rename the zip file extension to jar.

3. 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.

In my case all the files were in wmf format but a batch conversion to jpg was easy enough.

Great stuff Erel. :D
 
Top