display image 1, then image 2, etc from db.
And save the OutputStream to file, ending up with all the images on SD Card.
I tried
but ended up with only the first file named 8.png.
How would I have each OutputStream overwrite the previous one so that I always have only one file in DirDefaultExternal?
Something like the MS-DOS command prompt:
Dir > 1.png
Many thanks in advance for all tips.
B4X:
Sub Button1_Click
If pos = 61 Then
pos = 0
ReadBlob
prnt2 '
Else
pos = pos + 1
ReadBlob
prnt2 ' Save to file.
End If
End Sub
B4X:
Sub prnt2
Dim Cursor3 As Cursor = SQL1.ExecQuery("select image FROM MyTable WHERE name = name")
Cursor3.Position = pos
Dim Bmp As Bitmap '
If Cursor3.RowCount > pos Then
Dim binImage() As Byte, Otpt As InputStream
binImage = Cursor3.GetBlob("Image")
Otpt.InitializeFromBytesArray(binImage, 0, binImage.Length)
Bmp.Initialize2(Otpt)
Otpt.Close
End If
Cursor3.Close
Dim out As OutputStream = File.OpenOutput(File.DirDefaultExternal, pos & ".png" , True)
out.WriteBytes(binImage, 0, binImage.Length)
out.Close
End Sub
B4X:
Dim out As OutputStream = File.OpenOutput(File.DirDefaultExternal, 8 & ".png" , True)
How would I have each OutputStream overwrite the previous one so that I always have only one file in DirDefaultExternal?
Something like the MS-DOS command prompt:
Dir > 1.png
Many thanks in advance for all tips.
Last edited: