En todos los teléfonos que he probado, incluido el Galaxy Nexus con API 2.3.7 y 4.0 después de que el método takePicture se denomina cambios de la vista de superficie en la imagen que se tomó, "Revision de imagen".La revisión de la imagen no se muestra después de camera.takePicture
que he probado en estos dispositivos de tableta y la revisión de la imagen no se presentó: XOOM API 3.1 Galaxy Tab 10.1 API 3.1 Galaxy Tab 10.1 API 3,2
surfaceView = (SurfaceView)findViewById(R.id.surfaceView);
surfaceHolder = surfaceView.getHolder();
surfaceHolder.addCallback(this);
surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
...
public void takePicture() {
cam.takePicture(this, null, this); //Shuttercallback, RawCallback, JpegCallback
}
...
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
// Stop preview before changing camera parameters
if(isPreviewRunning) {
this.cam.stopPreview();
}
Camera.Parameters p = this.cam.getParameters();
LogUtils.info("CheckCapture", "Preview Size: " + String.valueOf(width) +"x" + String.valueOf(height));
p.setPreviewSize(width, height);
//Set picture size to a multiple of previewSize to maintain aspect ratio AND minimum capture width
//LogUtils.info("CheckCapture", "Picture Size: " + String.valueOf(width*factor) +"x" + String.valueOf(height*factor));
p.setPictureSize(width, height);
p.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO);
//Set picture format (we can check device capabilities, but all devices at API level 8 should support JPEG)
p.setPictureFormat(PixelFormat.JPEG);
//Set new camera parameters
try {
this.cam.setParameters(p);
}catch (Exception e) {
e.printStackTrace();
}
//Setup preview display on our surfaceViewHolder
try {
this.cam.setPreviewDisplay(surfaceHolder);
} catch (IOException e) {
e.printStackTrace();
}
//Start preview
this.cam.startPreview();
this.isPreviewRunning = true;
}
Parece un problema que tengo [aquí] (http://stackoverflow.com/questions/11676726/its-a-kind-of-magic-videoview-and-displaying-videos- on-android-3-1-vs-4-1) pero con videos y con los mismos dispositivos. ¿Lo arreglaste? – 2dvisio
Lamentablemente me di por vencido y tomé un enfoque similar al de Dinesh. Obtenga la imagen de la captura y muéstrela en un ImageView como, 'imageView.setImageBitmap (ImageUtils.jpegDecode (data));' –