Is this correct?
It does not look correct.
shouldn't I be getting my reference to the Camera in onResume() as well
I would skip the "as well" part and simply obtain the Camera
instance in onResume()
.
IOW, you want parallelism:
If you clean it up in
onPause()
, set it up inonResume()
If you clean it up on
onStop()
, set it up inonStart()
(or possibly the combination ofonCreate()
andonRestart()
If you clean it up in
onDestroy()
, set it up inonCreate()
In the case of a Camera
, you do not want to hold onto it when you are not in the foreground, as other apps cannot access it while you have it, so I would go for the onResume()
/onPause()
pairing.