1

Hello I am creating an application in which camera captures images automatically at a interval of 1 second. In below code I can take images on button click. But I want auto-camera. Here is the code. Please help me how can I create?

Sub Process_Global

End Sub

Sub Globals
    Dim camera1 As Camera
    Dim btnTakePicture As Button
    Dim Panel1 As Panel
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("1")
End Sub

Sub Camera1_Ready (Success As Boolean)
    If Success Then
        camera1.StartPreview
        btnTakePicture.Enabled = True
    Else
        ToastMessageShow("Cannot open camera.", True)
    End If
End Sub

Sub Activity_Resume
    btnTakePicture.Enabled = False
    camera1.Initialize(Panel1, "Camera1")
End Sub

Sub Activity_Pause (UserClosed As Boolean)
    camera1.Release
End Sub

Sub Camera1_PictureTaken (Data() As Byte)
    camera1.StartPreview
    Dim t As Long
    Dim filename As String
    t = DateTime.Add(DateTime.Now,0,0,1)
    filename = t & ".jpg"
    Dim out As OutputStream
    out = File.OpenOutput(File.DirRootExternal, filename, False)
    out.WriteBytes(Data, 0, Data.Length)
    out.Close
    ToastMessageShow("Image Saved" , True)
    btnTakePicture.Enabled = True
End Sub

Sub btnTakePicture_Click
    btnTakePicture.Enabled = False
    camera1.TakePicture
End Sub
RatDon
  • 3,403
  • 8
  • 43
  • 85
ching lee
  • 11
  • 7
  • Please highlight your code and indent them properly. – RatDon Mar 20 '15 at 05:46
  • @ratdon I want when i run application then take images automatically at the interval of 1 seconds. i donot need a extra button to capture images. – ching lee Mar 20 '15 at 06:02
  • Sorry. I don't belong to that domain. I suggested you to construct the question properly so that if someone from this domain finds your question, it'll be useful for them to read. – RatDon Mar 20 '15 at 06:10

0 Answers0