Camera.Size previewSize = findPreviewSizeByScreen(p);
p.setPreviewSize(previewSize.width, previewSize.height);
p.setPictureSize(previewSize.width, previewSize.height);
In the method of setParameters(Camera.Parameters p), there is an exception which can't be caught when application running. The supported PictureSizes of some phones don't contain previewSize got from findPreviewSizeByScreen(p). So we need obtain the supported PictureSizes firstly, and then set proper pictureSize through some algorithm. A simple example,
List<Camera.Size> pictureSizesList = p.getSupportedPictureSizes();
p.setPictureSize(pictureSizesList.get(5).width, pictureSizesList.get(5).height);
...
Camera.Size previewSize = findPreviewSizeByScreen(p);p.setPreviewSize(previewSize.width, previewSize.height);p.setPictureSize(previewSize.width, previewSize.height);In the method of setParameters(Camera.Parameters p), there is an exception which can't be caught when application running. The supported PictureSizes of some phones don't contain previewSize got from findPreviewSizeByScreen(p). So we need obtain the supported PictureSizes firstly, and then set proper pictureSize through some algorithm. A simple example,
List<Camera.Size> pictureSizesList = p.getSupportedPictureSizes();p.setPictureSize(pictureSizesList.get(5).width, pictureSizesList.get(5).height);...