Tengo un problema extraño en mi aplicación de cámara cuando se prueba con Galaxy Nexus ... simplemente se bloquea cuando intento iniciar la actividad de la cámara ... Pero funciona bien con casi todos los demás dispositivos ... Estos son mis funciones .....cámara accidente inesperadamente en galaxy nexus
@Override
public void surfaceCreated(SurfaceHolder holder) {
// TODO Auto-generated method stub
try {
camera = Camera.open();
camera.setPreviewDisplay(holder);
Camera.Parameters parameters = camera.getParameters();
if (Integer.parseInt(Build.VERSION.SDK) >= 8)
setDisplayOrientation(camera, 90);
else
parameters.set("orientation", "portrait");
parameters.setPictureFormat(PixelFormat.JPEG);
camera.setParameters(parameters);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width,
int height) {
// TODO Auto-generated method stub
if(previewing){
camera.stopPreview();
previewing = false;
}
if (camera != null){
try {
camera.setPreviewDisplay(surfaceHolder);
camera.startPreview();
previewing = true;
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
¿alguien puede ayudar mí?
Coloque el logcat Exception/Crash también. –
@AdilSoomro sorry..unfortunately no tengo que now..i no tiene el teléfono Nexus también .. – hacker
probablemente becoz va a iniciar y detener la cámara en surfaceChanged. Es mejor startPreview en onResume() y stopPreview en onPause(). Su trabajo para mi aplicación sobre Galaxy Nexus. –