Android Question Problem with files in folders asset

Hello friends
In b4a version 10.7 and above in Asset, if we create a folder and, for example, we want to read an image of that folder in the project, it gives the error of not finding the file.

There is a way to solve this problem?

@Erel
 

Andrew (Digitwell)

Well-Known Member
Licensed User
Longtime User
 
Upvote 0
Please upload a small project that demonstrates it.

This project only loads an html file from a folder in the asset & another project load pic file from a floder in the asset with amir_glide

in b4a you load version 10.5 but in b4a version 11 it does not load

@Erel
 

Attachments

  • html.zip
    2.9 KB · Views: 219
  • pic.zip
    110 KB · Views: 226
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
from a floder in the asset with amir_glide
1. Don't waste your time with unmaintained and unneeded libraries.

2. I don't recommend you to use subfolders in the assets folder.
3. This code will work:
B4X:
Sub Process_Globals
    Private xui As XUI
End Sub

Sub Globals
    Private web As WebView
End Sub

Sub Activity_Create(FirstTime As Boolean)
    web.Initialize("")
    Activity.AddView(web,0,0,100%x,100%y)
    web.LoadUrl(xui.FileUri(File.DirAssets, "icon\test.htm")) 'ignore
End Sub

4. To get it working in debug mode, you will need to add:
B4X:
#DebuggerForceStandardAssets: true

Note that the change is related to a behavior change in the underlying packaging tool (AAPT2).
 
Upvote 0
1. Don't waste your time with unmaintained and unneeded libraries.

2. I don't recommend you to use subfolders in the assets folder.
3. This code will work:
B4X:
Sub Process_Globals
    Private xui As XUI
End Sub

Sub Globals
    Private web As WebView
End Sub

Sub Activity_Create(FirstTime As Boolean)
    web.Initialize("")
    Activity.AddView(web,0,0,100%x,100%y)
    web.LoadUrl(xui.FileUri(File.DirAssets, "icon\test.htm")) 'ignore
End Sub

4. To get it working in debug mode, you will need to add:
B4X:
#DebuggerForceStandardAssets: true

Note that the change is related to a behavior change in the underlying packaging tool (AAPT2).

tnq

Well, in order to load images in lists with a large number of items, we must use the glide
What do you suggest to use?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
 
Upvote 0

Ohanian

Active Member
Licensed User
Longtime User
Hello friends
In b4a version 10.7 and above in Asset, if we create a folder and, for example, we want to read an image of that folder in the project, it gives the error of not finding the file.

There is a way to solve this problem?

@Erel
Hi,

I had the same problem, here's a strange solution :

try to change \ to /

B4X:
web.LoadUrl(xui.FileUri(File.DirAssets, "icon\test.htm"))

to

B4X:
web.LoadUrl(xui.FileUri(File.DirAssets, "icon/test.htm"))
 
Upvote 0
Top