Android Question CamEx2 Error : Camera 0: Got error Invalid argument (-22) after ...

uniplan

Active Member
Licensed User
Hi, i'm using the CamEx2 Library on my Huawei P20 Pro (Android 8), buta i receive this message when i try to take a Photo.

android.hardware.camera2.CameraAccessException: CAMERA_ERROR (3): submitRequestList:283: Camera 0: Got error Invalid argument (-22) after trying to submit capture request

How i can solve it?
Thank you
 

netsistemas

Active Member
Licensed User
add wait 150 ms.

B4X:
'Takes a picture now. Without waiting for the picture to be focused.
Public Sub TakePictureNow (MyTaskIndex As Int) As ResumableSub
    If MyTaskIndex <> TaskIndex Then Return False
    Camera.AbortCaptures
    Dim builder As JavaObject = Camera.CreateCaptureBuilder
    Dim SensorOrientation As Int = GetFromCameraCharacteristic("SENSOR_ORIENTATION")
    Dim front As Int = 1
    If getIsFrontFacingCamera Then front = -1
    Dim orientation As Int = (SensorOrientation + jcamera.GetField("lastKnownOrientation") * front + 360) Mod 360
    CaptureSettingMap.Put("JPEG_ORIENTATION", orientation)
    SetSettingsFromMap(builder, CaptureSettingMap)
    Dim CaptureRequest As Object = Camera.AddCaptureRequest(builder)
    If PrintKeys Then PrintAllKeys(CaptureRequest, "Capture Request")
    '******************* IN THIS SITE:    OK FOR ME, But i go to try more times...'
    Sleep (150)
    Wait For Camera_PictureTaken (Data() As Byte)
    StartPreview(MyTaskIndex, False)
    Return Data
End Sub
 
Upvote 0
Top