I want to release the camera only when user goes to strobe activity or else he exits the app by back button.
If you do not release the camera resources as soon as possible, the user will not be able to use the camera from any other application. For example, if a user of your application clicks the home button, the camera object will be blocked by your application. This will lead to unpleasant behavior: for example, the user cannot start the Camera application.
As official docs suggest:
It is important . Call release () to release the camera for use by other applications. Applications must immediately release the camera in onPause ()
I want to release the camera only when user goes to strobe activity or else he exits the app by back button
If you do not release the camera resources manually, they will not be released, just press the return button and "exit" from your application.
Also I want to reacquire the camera if the user is coming back to flashlight activity from strobe activity. Is their anyway to do this.?
Just connect to your camera in onResume () and free resources in onPause ().
source share