Code example for Camera.Parameters

Methods: getPictureSize, setPreviewSize

        // that have the same aspect ratio. Try searching from the original picture size and letting 
        // the UI scale. 
        if (size == null) {
                    "Couldn't find the best size that maps pixel-for-pixel on the screen. Trying larger ones..."); 
            final Size picSize = p.getPictureSize();
            size = getBestPreviewSize(picSize.width, picSize.height, p, (float) picSize.width
                    / picSize.height);
        // ok, this isn't good. But it's better than failing. 
        if (size == null) {
                    "Trying to find the best size, but couldn't find one with the request aspect ratio (" 
                            + mForceAspectRatio + "). Ignoring ratio request...");
            size = getBestPreviewSize(w, h, p, 0f);
        p.setPreviewSize(size.width, size.height);
        // start preview with new settings 
        try { 
Experience pair programming with AI  Get Codota for Java