Android Question Automatic pics

clooney48

Active Member
Licensed User
Longtime User
Hi!

I want to make an app which takes after start immediately 2 pics automatically i.e. the user doesn´t have to push a button and even doesn´t see a preview. I think this should be possible with the CameraExClass but I don´t succeed.

This apparently doesn´t work because of "Panel1":
B4X:
'Activity module
Sub Process_Globals
    Private frontCamera As Boolean = False
End Sub

Sub Globals
    Private Panel1 As Panel
    Private camEx As CameraExClass
End Sub

Sub Activity_Create(FirstTime As Boolean)
'    Activity.LoadLayout("DBView")
    InitializeCamera 'Would have been too easy  ;-)
    camEx.TakePicture 'Would have been too easy  ;-)
End Sub

Sub Activity_Resume
    InitializeCamera
End Sub

Private Sub InitializeCamera
    camEx.Initialize(Panel1, frontCamera, Me, "Camera1")
    frontCamera = camEx.Front
End Sub

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

Sub Camera1_Ready (Success As Boolean)
    If Success Then
        camEx.SetJpegQuality(90)
        camEx.CommitParameters
        'camEx.StartPreview
        'Log(camEx.GetPreviewSize)
    Else
        ToastMessageShow("Cannot open camera.", True)
    End If
End Sub

.....
 

clooney48

Active Member
Licensed User
Longtime User
Because I didn´t load "DBView" this error message is shown: "Did you forget to call Activity.Loadlayout" "Error in java line 278"
 
Upvote 0
Top