I’m trying to understand interesting thing. I made simple application with SurfaceView and Button. SurfaceView shows camera preview and Button shoot picture. Everything goes good except one moment:
If i press home button, my app goes to background, ok, then i turn screen off/on, then i tap on app icon and my app moves to foreground and everything is correct, i see preview camera again. BUT If i turn screen off/on without moving my app to background, then i see black preview without camera and cant make any pictures.
Please, help, i broke my brain 🙂
Thank you for your help!
is it possible that the activity is being destroyed and yet the camera is now still “locked” so not even the camera app can show a preview of it?
anyway , you should stop previewing the camera upon onPause (and releasing it upon onDestroy) and resume it when needed.