Android Question camera2 CamEx2 set CaptureSize

uniplan

Active Member
Licensed User
Longtime User
I am using the camera2 library and the CamEx2 module. I looked at the tutorial and the related example and everything works relatively well.
I would like to have the possibility to let the user who takes the photo choose the size to use.
I can list the possible sizes with the following code:

B4X:
    Dim PreviewSizes As List = cam.GetSupportedCaptureSizes()
    For Each Size As CameraSize In PreviewSizes
        Log("Width: " & Size.Width & ", Height: " & Size.Height)
    Next

but how do you set the size? I saw that the CamEx2 module in the initialization function has the instruction:
B4X:
CaptureSize.Initialize(1920, 1080)

But what if I want to change this size after the module has been initialized, how can I do that?
 
Solution
Something like:
B4X:
cam.PreviewSize.Initialize(1920, 1080)
Wait For (cam.PrepareSurface(MyTaskIndex)) Complete (Success As Boolean)
Top