我有一个在某些设备上可以正常工作的定制相机。它在三星 Galaxy Gran Duos (samsung-gt i9082, Android 4.2.2) 上运行良好,但是当我尝试捕捉之前放大的图像时,它会冻结,没有崩溃,唯一的退出方法是按下返回键。这只发生在三星 Galaxy Gran Duos 中。
我用来拍照的代码:
Camera.PictureCallback photoCallback = new Camera.PictureCallback() {
public void onPictureTaken(byte[] data, Camera camera) {
try {
} catch (Exception e) {
if (flePicture== null){
Log.d("camera", "Error creating media file, check storage permissions: " +
e.getMessage());
return;
}
}
try {
FileOutputStream fos = new FileOutputStream(flePicture);
fos.write(data);
fos.close();
} catch (FileNotFoundException e) {
Log.d("camera", "File not found: " + e.getMessage());
} catch (IOException e) {
Log.d("camera", "Error accessing file: " + e.getMessage());
}
}
};
以及用于放大的代码:
private void zoomIn() {
if (pblnInPreview) {
Camera.Parameters parameters = camCamera.getParameters();
if ((parameters.getZoom() + 1) < parameters.getMaxZoom()) {
parameters.setZoom(parameters.getZoom() + 1);
camCamera.setParameters(parameters);
}
}
}
日志猫:
04-07 17:21:14.386: E/BrcmCamera(130): processControlBuffer: Corrupt stream error raised by camera - sensor communication failure