LucaMs Expert Licensed User Longtime User May 13, 2020 #1 The second method, ReadFromStream, does not exist. I suppose for technical problems. Anyway, I have to search for a way to "realize" it Found this Erel's routine (Snippets forum): B4X: Sub FileToBytes (Dir As String, FileName As String) As Byte() Return Bit.InputStreamToBytes(File.OpenInput(Dir, FileName)) End Sub Of course it will work, I have not tried, but... even if the question is correct (how come the WriteToStream method exists and not its reciprocal ReadFromStream), I already have an array of bytes and I have to load them into a B4XBitmap (B4J) . Searching again Last edited: May 13, 2020
The second method, ReadFromStream, does not exist. I suppose for technical problems. Anyway, I have to search for a way to "realize" it Found this Erel's routine (Snippets forum): B4X: Sub FileToBytes (Dir As String, FileName As String) As Byte() Return Bit.InputStreamToBytes(File.OpenInput(Dir, FileName)) End Sub Of course it will work, I have not tried, but... even if the question is correct (how come the WriteToStream method exists and not its reciprocal ReadFromStream), I already have an array of bytes and I have to load them into a B4XBitmap (B4J) . Searching again
LucaMs Expert Licensed User Longtime User May 13, 2020 #2 LucaMs said: I have to load them into a B4XBitmap (B4J) Click to expand... I can do it too, but the problem is how to "pass" that B4XBitmap to an ImageView. Upvote 0
LucaMs said: I have to load them into a B4XBitmap (B4J) Click to expand... I can do it too, but the problem is how to "pass" that B4XBitmap to an ImageView.
LucaMs Expert Licensed User Longtime User May 13, 2020 #3 Ok, solved ? (but with the help by @LordZenzo ) B4X: Dim img As Image Dim InStream As InputStream InStream.InitializeFromBytesArray(arrByte, 0, arrByte.Length) img.Initialize2(InStream) B4XView1.SetBitmap(img) (changed the variable names, here. B4XView1 "contains" a B4J ImageView). Last edited: May 14, 2020 Upvote 0
Ok, solved ? (but with the help by @LordZenzo ) B4X: Dim img As Image Dim InStream As InputStream InStream.InitializeFromBytesArray(arrByte, 0, arrByte.Length) img.Initialize2(InStream) B4XView1.SetBitmap(img) (changed the variable names, here. B4XView1 "contains" a B4J ImageView).
LucaMs Expert Licensed User Longtime User May 14, 2020 #4 LucaMs said: I can do it too, but the problem is how to "pass" that B4XBitmap to an ImageView. Click to expand... It is much simpler; although the SetBitmap method of B4XView (a B4J ImageView) requires an Image type object, it accepts a B4XBitmp too. Upvote 0
LucaMs said: I can do it too, but the problem is how to "pass" that B4XBitmap to an ImageView. Click to expand... It is much simpler; although the SetBitmap method of B4XView (a B4J ImageView) requires an Image type object, it accepts a B4XBitmp too.