开发者

Galaxy tab 10.1 is calling to Camera.release() automatically when use OnPictureTaken(...) and shouldn't do it

开发者 https://www.devze.com 2023-03-25 21:03 出处:网络
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:

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号