Android Question Subdirectories in File.DirInternal?

Troberg

Well-Known Member
Licensed User
Is there a way to package files so that they end up in subdirectories of File.DirInternal?

Example:

File.DirInternal/Languages/English.lng
File.DirInternal/ColorSchemes/Red.sch

And, of course, I messed up when writing the post. It should be File.DirAssets, of course.
 
Last edited:

JoanRPM

Active Member
Licensed User
For expample, I load a bmp (in help directory) like this:

B4X:
Dim Bitmap1 As Bitmap
Dim imvT1 As ImageView
Bitmap1.Initialize(File.DirAssets,"help/t1.png")    'ignore
imvT1.Initialize("")
imvT1.Bitmap = Bitmap1
Activity.AddView(imvT1,262dip,51dip+90dip,3dip,145dip)
 

Troberg

Well-Known Member
Licensed User
Loading it is not the problem, how do I add the file to the project so that it ends up in a subdirectory? I can't find a way to define the dir structure for DirAssets.
 

Troberg

Well-Known Member
Licensed User
Ah, it was that easy...

Do I also have to include the files in the IDE, or is the entire Files dir included automatically?
 

NJDude

Expert
Licensed User
I believe the entire Files folder is included so be careful not to put any junk in it.
Yes, any files or directories in the FILES folder gets added to the APK, that directory should only contain the files pertaining to the app and nothing else.
 

Troberg

Well-Known Member
Licensed User
Yes, any files or directories in the FILES folder gets added to the APK, that directory should only contain the files pertaining to the app and nothing else.
Nope, didn't work. I just tried it, and only files directly in the Files folder where included, not subdirectories or files in them.

Example:

Info.png exists in both Files/ and Files/Icons/. Presumably, both should then be on the device.

B4X:
'Works
bm.Initialize(File.DirAssets, "info.png")

'Doesn't work
bm.Initialize(File.DirAssets & "/icons", "info.png")
 

Troberg

Well-Known Member
Licensed User
Found the problem. Apparently, File.DirAssets doesn't work like a normal dir. Changing the code to this helped:

B4X:
bm.Initialize(File.DirAssets, "icons/" & IconFileName)
In other words, the dir seems to be part of the filename, instead of the path.
 
Top