Sub Globals
Dim WebV As WebView
End Sub
Sub Activity_Create(FirstTime AsBoolean)
Activity.LoadLayout("Layout1")
WebV.Initialize("WebV")
Activity.AddView(WebV, 0dip, 0dip, 100%x, 100%y)
WebV.LoadHtml("<html><body background='" & WebViewAssetFile("image.jpg") & "'></body></html>")
End Sub
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