Code example for OrientationEventListener

Methods: disable

        // Because the CameraDevice object is not a shared resource, it's very 
        // important to release it when the activity is paused. 
        mCamera = null;
    private Size getOptimalPreviewSize(List<Size> sizes, int w, int h) {
        final double ASPECT_TOLERANCE = 0.05;
        double targetRatio = (double) w / h;
        if (sizes == null) return null;
        Size optimalSize = null;
        double minDiff = Double.MAX_VALUE;
        int targetHeight = h;
        // Try to find an size match aspect ratio and size 
Connect your IDE to all the code out there  Get Codota for Java