Sub Camera1_PictureTaken (Data() As Byte)
Dim filename As String = maxIDTabela("ODS_REGISTROS") & ".jpg"
Dim dir As String = File.DirRootExternal & "/AP-Memoria/Fotos"
camEx.SavePictureToFile(Data, dir, filename)
'camEx.StartPreview 'restart preview
camEx.CloseNow
'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)
ToastMessageShow("Picture saved." & CRLF & "File size: " & File.Size(dir, filename), True)
Dim bd As BitmapDrawable
bd.Initialize(LoadBitmap(Main.DBFileDir & "/Fotos",maxIDTabela("ODS_REGISTROS") & ".jpg"))
bd.Gravity = Gravity.Fill
pnlFoto.Background = bd
lblTirarFoto.Text = "Nova Foto"
End Sub