android 相机报错 setParameters failed
发布时间:2015-06-05 来源:查字典编辑
摘要:ListsizeList=parameters.getSupportedPreviewSizes();intPreviewWidth=640...
List sizeList = parameters.getSupportedPreviewSizes();
int PreviewWidth = 640;
int PreviewHeight = 480;
Boolean findSize = false;
if (sizeList.size() > 1) {
Iterator itor = sizeList.iterator();
while (itor.hasNext()) {
Camera.Size cur = itor.next();
if (cur.width >= PreviewWidth
&& cur.height >= PreviewHeight) {
findSize = true;
PreviewWidth = cur.width;
PreviewHeight = cur.height;
break;
}
}
}
if (!findSize) {
PreviewWidth = sizeList.get(0).width;
PreviewHeight = sizeList.get(0).height;
}
parameters.setPreviewSize(PreviewWidth, PreviewHeight);