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
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
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
My guess is that it is not related to the focus action.
You can catch this error with a try / catch block and inform the user that it failed to capture a picture. There isn't any other information there that can help.