Other answers have told you not to do this and why. But to answer your question:
Keep a reference to the Camera
instance in a static member variable, preferably in a separate class, like this:
public class Globals {
public static Camera myCamera;
}
This variable is available to all of your activities as Globals.myCamera
.
Put the instance of Camera
that you get from calling Camera.open()
into Globals.myCamera
. This will be available to both activities. When you are ready to release the camera, call Globals.myCamera.release()
and then set Globals.myCamera
to null
to indicate that you no longer have control of the camera.