'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim Camera1 As AdvancedCamera
Dim Button1 As Button
Dim Panel1 As Panel
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("Layout1")
End Sub
Sub Activity_Resume
Camera1.Initialize(Panel1, "Camera1")
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Camera1_Ready (Success As Boolean)
If Success Then
Camera1.StartPreview
Camera1.OriPortrait
Else
ToastMessageShow("Cannot open camera.", True)
End If
End Sub
Sub Button1_Click
Camera1.TakePicture
End Sub
Sub Camera1_PictureTaken (Data() As Byte)
Dim out As OutputStream
out = File.OpenOutput(File.DirInternal, "Image.jpg", False)
out.WriteBytes(Data, 0, Data.Length)
out.Close
'ToastMessageShow("Image saved: " & File.Combine(File.DirInternalCache, "Image.jpg"), True)
Dim Message As Email
Message.To.Add("[email protected]")
Message.Attachments.Add(File.Combine(File.DirInternal, "Image.jpg"))
StartActivity(Message.GetIntent)
End Sub