Sub Camera1_PictureTaken (Data() As Byte)
Dim aleatorio As Int
aleatorio = Rnd(111,3333)
Variables.aleatoriofoto1 = aleatorio
Dim filename As String = Variables.aleatoriofoto1 & ".png"
Dim dir As String = ruta & "/" & "DCIM"
camEx.SavePictureToFile(Data, dir, filename)
camEx.StartPreview 'restart preview
'send a broadcast Intent To the media scanner To force it To scan the saved File.
Dim Phone As Phone
Dim i As Intent
i.Initialize("android.intent.action.MEDIA_SCANNER_SCAN_FILE", _
"file://" & File.Combine(dir,filename))
Phone.SendBroadcastIntent(i)
Dim InputStream3 As InputStream
InputStream3 = File.OpenInput(dir, filename)
Dim OutputStream3 As OutputStream
OutputStream3.InitializeToBytesArray(1000)
File.Copy2(InputStream3, OutputStream3)
Dim Buffer2() As Byte
Buffer2 = OutputStream3.ToBytesArray
SQLfront.ExecNonQuery2("INSERT INTO T_ACTIVIDAD VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", Array As Object(Variables.empresa1,Variables.cserv1,Variables.personal_id1,Variables.fechahoy1,Variables.horahoy1,Variables.puesto1,Variables.act_mov1,Variables.Act_observ1,(Buffer2),Variables.act_gpslat1,Variables.act_gpslon1))
pic1.SetBackgroundImage(LoadBitmapSample(dir,filename,100,100))
End Sub