Hi,
By combining the signature capture tutorial:
http://www.b4x.com/forum/basic4android-getting-started-tutorials/9096-signature-capture-tutorial.html
and the SQL tutorial:
http://www.b4x.com/forum/basic4android-getting-started-tutorials/6736-sql-tutorial.html#post39108
I was able to capture a signature, save it to a png file, read it back, convert it into a blob in an sqlite database with success. This is used in a screen that displays an invoice header and capture the signature at the bottom.
My relevant code looks like this:
This led me to two questions:
1- Using the signature capture module general configuration, is there a shorter way to do this by eliminating the png file altogether and converting the SD data directly into the bytes array necessary for the SQLite blob update?
2- How would one go about pre-populating the signature capture canvas with a blob freshly read from an sqlite database. A previously saved signature in fact?
Thanks in advance for any help.
JF.
By combining the signature capture tutorial:
http://www.b4x.com/forum/basic4android-getting-started-tutorials/9096-signature-capture-tutorial.html
and the SQL tutorial:
http://www.b4x.com/forum/basic4android-getting-started-tutorials/6736-sql-tutorial.html#post39108
I was able to capture a signature, save it to a png file, read it back, convert it into a blob in an sqlite database with success. This is used in a screen that displays an invoice header and capture the signature at the bottom.
My relevant code looks like this:
B4X:
SignatureCapture.Save(SD, File.DirRootExternal, "sign.png")
ToastMessageShow("Signature saved to: " & File.Combine(File.DirRootExternal, "sign.png"), True)
Dim InputStream1 As InputStream
InputStream1 = File.OpenInput(File.DirRootExternal, "sign.png")
Dim OutputStream1 As OutputStream
OutputStream1.InitializeToBytesArray(1000)
File.Copy2(InputStream1, OutputStream1)
Dim Buffer() As Byte
Buffer = OutputStream1.ToBytesArray
'write the image to the database
Main.SQL.ExecNonQuery2("UPDATE tab_inv SET signature = ? where inv ="&Main.selected_invoice, Array As Object(Buffer))
This led me to two questions:
1- Using the signature capture module general configuration, is there a shorter way to do this by eliminating the png file altogether and converting the SD data directly into the bytes array necessary for the SQLite blob update?
2- How would one go about pre-populating the signature capture canvas with a blob freshly read from an sqlite database. A previously saved signature in fact?
Thanks in advance for any help.
JF.