Code example for OrientationEventListener

Methods: disable

0
        // Because the CameraDevice object is not a shared resource, it's very 
        // important to release it when the activity is paused. 
        mCamera.stopPreview();
        mCamera.release();
        mCamera = null;
        mOrientationListener.disable();
    } 
 
 
    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 
        for (Size size : sizes) {