Galaxy tab 10.1 is calling to Camera.release() automatically when use OnPictureTaken(...) and shouldn't do it
The next code works on android 2.3 and lower versions, I not understand why on HoneyComb don't work. The UI have 3 buttons: btnTakePic, btnDiscard, btnSave:
if(v.getId()==btnTakePic.getId()){
Log.v("Camarita", "BtnTake inicia");
if(cameraPreview){
开发者_开发问答 callback = new PictureCallback() {
@Override
public void onPictureTaken(byte[] data, Camera camera) {
dataTemp=new byte[data.length];
System.arraycopy(data,0,dataTemp , 0, data.length);
}
};
mCamera.takePicture(null, null, callback);
callback=null;
cameraPreview=false;
}else{
//NOTHING
}
}
btnDiscard clean the array dataTemp and call to Camera.startPreview(). btnSave save the image from dataTemp and clean dataTemp. Then call to Camera.startPreview().
Finally I could fix this issue adding manually Camera.stopPreview() when btnTakePic is pressed.
Greetings
精彩评论