Code example for Camera

Methods: addCallbackBuffer

0
        mCamera.setPreviewCallbackWithBuffer(new PreviewCallback() {
            public void onPreviewFrame(byte[] data, Camera camera) {
                // Whenever a camera preview frame is ready, just copy it straight to our mFrame, 
                // and don't worry about blocking the main UI thread until it is safe. 
                System.arraycopy(data, 0, mFrame, 0, data.length);
                camera.addCallbackBuffer(mBuffer);
                 
                // Signal that a camera frame is ready, without blocking the main thread. 
                mCameraIsInitialized = true;
            } 
        }); 
        return true; 
    } 
     
    public void releaseCamera() { 
        Log.i(TAG, "releaseCamera");
        mThreadRun = false;
        synchronized (this) {
            if (mCamera != null) {
                mCamera.stopPreview();
                mCamera.setPreviewCallback(null);