Pictures and SQL Lite

Ennesima77

Member
Licensed User
Longtime User
Hi everybody,
I tryed to find out somithing similar but I can't.
I build a new activity for Player Info (It's for my privite club) and I want to take a picture to save that in a SQLLite DB.
Activity can take the picture using Camera lib and it can save the temporary file to save the picture in the DB and show it in the preview (ImageView).
I use this code to peform this:

Sub bttSave_Click


Dim StringSQL As StringBuilder
StringSQL.Initialize
If PlayerCode ="" Then
Dim RecordData As List
RecordData.Initialize
Dim PlayerData As Map
PlayerData.Initialize
PlayerData.Put("Name",txtName.Text )
PlayerData.Put("SecondName", txtSurName.Text)
PlayerData.Put("FullName",txtFullName.Text)
PlayerData.Put("playerid",txtPlayerID.Text)
PlayerData.Put("BirthDay",txtBirthDay.Text)
PlayerData.Put("SubDate",DateTime.Now)
PlayerData.Put("mobile",txtDocNumber.Text)
PlayerData.Put("sendsms",chkSendSMS.Checked)
Dim InputStream1 As InputStream
InputStream1 = File.OpenInput(File.DirDefaultExternal ,"temp.jpg")
Dim OutputStream1 As OutputStream
OutputStream1.InitializeToBytesArray(1000)
File.Copy2(InputStream1, OutputStream1)
Dim Buffer() As Byte
Buffer = OutputStream1.ToBytesArray

PlayerData.Put("picture",Buffer)
RecordData.Add(PlayerData)
DBUtils.InsertMaps(Main.SQLDB ,"Players", RecordData)

Else
'Performs a Player Update
End If

End Sub

It work fine, but if I want to load picture from the blob how can I do?
And also it's possibile extract buffer direct from the preview?
 

Ennesima77

Member
Licensed User
Longtime User
Thanks for your reply.
I found that just 5 minutes ago and it's easyer now with your tutorial.
:)
 
Upvote 0

Ennesima77

Member
Licensed User
Longtime User
There is an example in this tutorial: SQL tutorial

It is not possible to extract the buffer from the preview.

It's possible save the picture in a file from a imageview?
 
Upvote 0
Top