I have a code something like the following:
Let say I want to access the first bitmap blob, since the data already in Byte, I just assigned it to
?
However I get an error saying InputStream is not initialized.
My second question is how do you access a particular blob inside the RandomAccessFile? Can we just use imgIS.ReadObject(0), imgIS.ReadObject(5) and assign those to byte objects?
Thank you.
B4X:
Sub readQuestionData
Dim imgFile As RandomAccessFile
Dim buffer() As Byte
Dim i As Int
cursorQuestion = sqlQuestion.ExecQuery("SELECT * FROM question")
For i = 0 To cursorQuestion.RowCount - 1
cursorQuestion.Position = i
buffer = cursorQuestion.GetBlob("QUESTION")
imgFile.Initialize3(buffer, True)
imgFile.WriteObject(QuestionList, True, imgFile.CurrentPosition)
Next
cursorQuestion.Close
Dim imgIS As InputStream
Dim imgBuffer() As Byte
imgBuffer = imgFile.ReadObject(0)
imgIS.InitializeFromBytesArray(imgBuffer, 0, imgBuffer.Length)
Dim imgQuestion As Bitmap
imgQuestion.Initialize2(imgIS)
imgIS.Close
Activity.SetBackgroundImage(imgQuestion)
End Sub
Let say I want to access the first bitmap blob, since the data already in Byte, I just assigned it to
B4X:
imgBuffer = imgFile.ReadObject(0)
However I get an error saying InputStream is not initialized.
My second question is how do you access a particular blob inside the RandomAccessFile? Can we just use imgIS.ReadObject(0), imgIS.ReadObject(5) and assign those to byte objects?
Thank you.