Android获取Camera支持的分辨率


Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
for(int cameraId=0; cameraId previewSIzes = params.getSupportedVideoSizes(_);
        logger.info("Video supported sizes: " + cameraSizesToString( previewSizes));
}

因为我们直接log输出previewSIzes的话,格式不是我们能看懂的整数,

所以我写了个cameraSizesToString()转化成类似640x420的格式

public static String cameraSizeToSting(Iterable sizes)
{
       StringBuilder s = new StringBuilder();
       for (Camera.Size size : sizes)
       {
           if (s.length() != 0)
                s.append(",");
           s.append(size.width).append('x').append(size.height);
        }
        return s.toString();
}


你可能感兴趣的:(Android开发)