Get CameraX final resolution
07:12 12 Sep 2019

Just created a camera preview in Android with CameraX with the following configuration:

    PreviewConfig previewConfig = new PreviewConfig.Builder()
            .setLensFacing(CameraX.LensFacing.FRONT)
            .setTargetResolution(new Size(720, 720))
            .build();
    Preview preview = new Preview(previewConfig);

Now, the problem is that such target resolution may not be available, in which case the preview will choose a resolution closed to the requested one. What I'm asking here is a way to know which resolution has effectively be chosen by the preview.

Thanks in advance!

java android android-camerax