YuvImage image = new YuvImage(data, ImageFormat.NV21, size.width, size.height, null); if(image!=null){ ByteArrayOutputStream stream = new ByteArrayOutputStream(); image.compressToJpeg(new Rect(0, 0, size.width, size.height), 80, stream); byte[] bytes = stream.toByteArray(); bmp = BitmapFactory.decodeByteArray(bytes, 0, bytes.length); imageView.setImageBitmap(bmp); stream.close();
请描述你碰到的具体错误
断点调试,看你的image是不是空的
byte的数据无法转换为bitmap