Ask Your Question

Revision history [back]

Open, then manually set the width and height inside InitializeCamera():


/* Now set camera parameters */
try {
    Camera.Parameters params = mCamera.getParameters();
    Log.d(TAG, "getSupportedPreviewSizes()");
    List<android.hardware.Camera.Size> sizes = params.getSupportedPreviewSizes();

    if (sizes != null) {
        /* Select the size that fits surface considering maximum size allowed */
        width = 1080;
        height = 1920;
        Size frameSize = calculateCameraFrameSize(sizes, new JavaCameraSizeAccessor(), width, height);


In my case, it's portrait. So switch it up if you want landscape. Unfortunately this is hardcoded, so please someone chime in for a dynamic solution.