@Erel
You provided the code below for B4A, to load an image from the library jar file instead of the Assets folder. It will not work in B4J. Can you povide the changes or new code that will? Also, it would be nice to load a data file or list this way as well. Thanks for any help:
You provided the code below for B4A, to load an image from the library jar file instead of the Assets folder. It will not work in B4J. Can you povide the changes or new code that will? Also, it would be nice to load a data file or list this way as well. Thanks for any help:
B4X:
Private Sub LoadFileFromJar(FileName As String) As InputStream
'If fromAssets Then Return File.OpenInput(File.DirAssets, FileName)
If File.Exists(File.DirAssets, "ftypes") Then Return File.OpenInput(File.DirAssets, FileName)
Dim r As Reflector
r.Target = Me
r.Target = r.RunMethod("getClass")
Dim In As InputStream = r.RunMethod2("getResourceAsStream", "/" & FileName, "java.lang.String")
If In.IsInitialized = False Then
LogColor("Cannot find file: " & FileName, Colors.Red)
End If
Return In
End Sub
Private Sub LBFJ(FileName As String) As Bitmap
Dim bmp As Bitmap
Dim In As InputStream = LoadFileFromJar(FileName)
bmp.Initialize2(In)
In.Close
Return bmp
End Sub