Hello,
I am trying to receive a jpeg image from an application running on PC and I use AsyncStreams for that.
Since I cannot use prefix mode, the image comes in chunks on the android application.
So "_NewData" event is called many times and I need to gather all parts of jpeg and finally concat them.
I am trying to do it using lists.
So my code is like :
In order to understand the end of file for jpeg, I read the last two bytes of every chunk and when these last two bytes are FFD9 (hex) then I suppose it's the correct end of file for Jpeg.
The problem is that when all the jpeg image has been received in input_list, then I cannot find out how to use this list to save the image in jpeg format or to display the image on an imageview.
Can please someone help ?
Thank you
I am trying to receive a jpeg image from an application running on PC and I use AsyncStreams for that.
Since I cannot use prefix mode, the image comes in chunks on the android application.
So "_NewData" event is called many times and I need to gather all parts of jpeg and finally concat them.
I am trying to do it using lists.
So my code is like :
B4X:
...
Dim input_list As List
...
input_list.initialize
...
Sub stream1_NewData (buffer() As Byte)
...
input_list.AddAll(buffer)
...
End Sub
The problem is that when all the jpeg image has been received in input_list, then I cannot find out how to use this list to save the image in jpeg format or to display the image on an imageview.
Can please someone help ?
Thank you