Hey everyone,
I pick a file with filedialog and I want to put it into a bytearray.
I think this should do it, but nothing is written into it.
Lenght gives 0 and msg gives nothing
2) Also, I have 2 files in my external SD root, but I cannot seem to open livestream.jpg but I can open .bmp
but not
Error loading bitmap.
In the documentation, a jpg is used:
Strangen here I just found out that if I remove livestream.jpg from my sd card, they place it again on my root. Open the app, select the file, it works. Second time I try (without removing) I got an error loading bitmap.
I pick a file with filedialog and I want to put it into a bytearray.
I think this should do it, but nothing is written into it.
B4X:
Dim fd As FileDialog
Dim outlayImage As OutputStream
Dim overlayImage() As Byte
btmpImageLoader.Initialize(File.DirRootExternal, fd.ChosenName)
outlayImage = File.OpenOutput(File.DirRootExternal,fd.ChosenName,False)
btmpImageLoader.WriteToStream(outlayImage,100,"JPEG")
outlayimage.InitializeToBytesArray(0)
overlayImage = outlayimage.ToBytesArray
B4X:
Msgbox(overlayImage.Length,"")
Dim msg As String
msg = BC.HexFromBytes(overlayImage)
Msgbox(msg,"")
Lenght gives 0 and msg gives nothing
2) Also, I have 2 files in my external SD root, but I cannot seem to open livestream.jpg but I can open .bmp
B4X:
btmpImageLoader.Initialize(File.DirRootExternal, "livestream.bmp")
B4X:
btmpImageLoader.Initialize(File.DirRootExternal, "livestream.jpg")
In the documentation, a jpg is used:
B4X:
Initialize (Dir As String, FileName As String)
Initializes the bitmap from the given file.
Example:
Dim Bitmap1 As Bitmap
Bitmap1.Initialize(File.DirAssets, "X.jpg")
Strangen here I just found out that if I remove livestream.jpg from my sd card, they place it again on my root. Open the app, select the file, it works. Second time I try (without removing) I got an error loading bitmap.
Last edited: