Android Question Onfocus Camex

Croïd

Active Member
Licensed User
Longtime User
HI, I use this code to divert the focus function but on some devices, but I have a crash !

Is there another solution?

B4X:
Try
    If camera1.GetSupportedFocusModes.IndexOf("auto") > -1 Then
        camera1.FocusAndTakePicture
    Else
        camera1.TakePicture
        End If
    Catch
        Log(LastException)
    End Try
 

Attachments

  • crash.txt
    1.2 KB · Views: 399

Croïd

Active Member
Licensed User
Longtime User
Try to add a short sleep before the image is taken:
B4X:
'CameraExClass
Private Sub Camera_FocusDone (Success As Boolean)
   If Success Then
     Sleep(100) '<-----
     TakePicture
   Else
     Log("AutoFocus error.")
   End If
End Sub

Thank you Erel, I will watch and I will keep you informed
 
Upvote 0
Top