Files missing ?

FabioG

Active Member
Licensed User
Longtime User
Hello,

I have a problem, I added a required file for my application in the "Files" directory

but after compiling the app the file is not included.

how can I fix this?
thanks
 

NJDude

Expert
Licensed User
Longtime User
The "Files" directory in the IDE adds the file(s) to the APK, to get the file in your code you have to use File.DirAssets, for more information, read THIS

Note that sometimes you might need to copy the file(s) from the assets to the SDCard, you can search the forums or read the documentation for more info.
 
Upvote 0

FabioG

Active Member
Licensed User
Longtime User
The "Files" directory in the IDE adds the file(s) to the APK, to get the file in your code you have to use File.DirAssets, for more information, read THIS

Note that sometimes you might need to copy the file(s) from the assets to the SDCard, you can search the forums or read the documentation for more info.

My code is this :
B4X:
   Dim FileHTML As String
   FileHTML = File.DirAssets & "/dovesiamo.htm"
   WebView1.Initialize("")
   Activity.AddView(WebView1,0,0,100%x,100%y)
   WebView1.LoadUrl("file://" & FileHTML)

I put the file dovesiamo.html in the "Files" directory
but does not work

can you help me?

thanks
 
Upvote 0

NJDude

Expert
Licensed User
Longtime User
The right way should be:
B4X:
Dim FileHTML As String

FileHTML = File.GetText(File.DirAssets, "dovesiamo.htm")

WebView1.Initialize("")

Activity.AddView(WebView1,0,0,100%x,100%y)

WebView1.LoadUrl(FileHTML)
 
Upvote 0

FabioG

Active Member
Licensed User
Longtime User
The right way should be:
B4X:
Dim FileHTML As String

FileHTML = File.GetText(File.DirAssets, "dovesiamo.htm")

WebView1.Initialize("")

Activity.AddView(WebView1,0,0,100%x,100%y)

WebView1.LoadUrl(FileHTML)

ok Thanks!
but works with
B4X:
WebView1.LoadHtml (FileHTML)
 
Upvote 0
Top