Android Question can i put a folder in File.DirAssets ?

Devv

Active Member
Licensed User
I have lots of files in my File.DirAssets
so i decided to organize them into folders
i made a folder in "\Android\Files\Loading"
i put some files in "Loading" folder, then i edited my code to
B4X:
ImageView2.SetBackgroundImage(LoadBitmap(File.DirAssets & "\Loading",i & ".jpg"))
now it stopped working ...
any ideas
 

Informatix

Expert
Licensed User
i followed erel's post and code and still having path problem.. seems it dies not work for all devices ..
Do you have an example of device ? Because my first app on Google Play runs without issue on a lot of different devices and has many subfolders in the assets. As suggested, their name is in lowercase.
 

Devv

Active Member
Licensed User
Do you have an example of device ? Because my first app on Google Play runs without issue on a lot of different devices and has many subfolders in the assets. As suggested, their name is in lowercase.
yes i changed the folder name to lowercase and edited the folder name on the code
i'am using galaxy s3, b4a 5
 

Mahares

Well Known Member
Licensed User
Instead of this:
B4X:
ImageView2.SetBackgroundImage(LoadBitmap(File.DirAssets & "\Loading",i & ".jpg"))
Your code should be like this (note the forward slash):
B4X:
ImageView2.SetBackgroundImage(LoadBitmap(File.DirAssets, "loading/" & i & ".jpg"))
 

johndb

Active Member
Licensed User
If I am not mistaken, I think you also have to put the following directive in your main #DebuggerForceStandardAssets: true if you want to access your folders during debug sessions.
 

walterf25

Expert
Licensed User
I have lots of files in my File.DirAssets
so i decided to organize them into folders
i made a folder in "\Android\Files\Loading"
i put some files in "Loading" folder, then i edited my code to
B4X:
ImageView2.SetBackgroundImage(LoadBitmap(File.DirAssets & "\Loading",i & ".jpg"))
now it stopped working ...
any ideas
I think the problem is that you are confusing the directories:
"\Android\Files\" directory is not in the Files.DirAssets but in the file.DirDefaultExternal directory.

Now if you created the \Android\Files\Loading\ directory in the File.DirAssets directory then your code should look like this.

B4X:
ImageView2.SetBackgroundImage(LoadBitmap(File.DirAssets & "\Android\Files\Loading",i & ".jpg"))
Hope this solves your issue.

Walter
 

Mahares

Well Known Member
Licensed User
If I am not mistaken, I think you also have to put the following directive in your main #DebuggerForceStandardAssets: true
It is not necessary.

ImageView2.SetBackgroundImage(LoadBitmap(File.DirAssets & "\Android\Files\Loading",i & ".jpg"))
I am afraid that is not the correct syntax if you are dealing with the assets folder or its subfolder. See post #8 for the correct code, tested and works.
 
Top