I use the following code when I want to display an image in an HTML string (the image is in the asset):
B4X:
Sub WebViewAssetFile (FileName As String) As String
Dim jo As JavaObject
jo.InitializeStatic("anywheresoftware.b4a.objects.streams.File")
If jo.GetField("virtualAssetsFolder") = Null Then
Return "file:///android_asset/" & FileName.ToLowerCase
Else
Return "file://" & File.Combine(jo.GetField("virtualAssetsFolder"), _
jo.RunMethod("getUnpackedVirtualAssetFile", Array As Object(FileName)))
End If
End Sub
This is how I then insert the image into my string:
B4X:
HTML = $"<img src="${WebViewAssetFile("MEINEDATEI.JPG")}">"$
How do I make it work if my image comes from the directory File.DirInternal?