I have one activity class(CameraActivity) which is using my CameraPreview class. In \"OnResume\" the camera and preview are initiated. In \"OnPause\", i am releasing camera
My working solution:
First:
In CameraActivity
class declare mCamera
as array:
Camera mCamera[] = new Camera[1];
Second: declaration of the constructor CameraPreview
must look like this:
public CameraPreview(Context context, Camera[] camera,
PreviewCallback previewCb,
AutoFocusCallback autoFocusCb) {
mCamera = camera;
...
}
But mCamera
in CameraPreview
class must be declared as follows:
Camera[] mCamera; // without instantiating of the array!
And finally: in both classes inside all the methods you should replace all references mCamera
by mCamera[0]
P.S: Sorry for my English