My app is using camera. i'm having a CameraActivity
class and CameraFragment
class,
CameraFragment is responsible for releasing the camera:
@Override
public void onPause() {
super.onPause();
if (mCamera != null) {
mCamera.release();
mCamera = null;
}
}
My app crashed while taking a picture. for some reason the camera was not released. now i can't get the camera object nowhere! Also the android Camera app is not working with an error "Can't connect to the camera"
now i know that the camera is a singleton object and only one app can get it in a time. what i don't understand is why onPause didn't run and how can i protect the camera instance better?
Also if something like that happens, how can i force release the camera object? it it a good idea?
sadly i don't have the information why the app crashed at the first place.
Thanks for your help.
Roy