WEB开发网
开发学院手机开发Android 开发 android 相机报错 setParameters failed 阅读

android 相机报错 setParameters failed

 2013-10-16 16:26:53 来源:WEB开发网   
核心提示:List<Camera.Size> sizeList = parameters.getSupportedPreviewSizes();int PreviewWidth = 640;int PreviewHeight = 480;Boolean findSize = false; if (sizeList.s
List<Camera.Size> sizeList = parameters.getSupportedPreviewSizes();
int PreviewWidth = 640;
int PreviewHeight = 480;
Boolean findSize = false;
				 
				if (sizeList.size() > 1) {
					Iterator<Camera.Size> 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);

Tags:android 相机 setParameters

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接