I've displayed a camera stream using TextureView. When switching camera (stopPreview() called before switching), front-to-back or vice-versa, the view paused at the last frame drawn on the TextureView. I want to display a blank screen while the "switching" is happening. How can I achieve it?
Asked
Active
Viewed 1,395 times
1 Answers
2
The easiest solution is to define a black view that overlays your camera preview surface. Set it's visibility "gone" while camera preview is working, and "visible" when you stopPreview and until the switch is over. With the deprecated camera API you can use setPreviewCallbackOnce() to get the indication that it's time to hide the overlay again.

Alex Cohn
- 56,089
- 9
- 113
- 307
-
1Haven't found a way to clear the preview as I've wanted. I've proceed with this same approach, overlay a view to hide the preview surface. Marking this answer as correct, still achieved the intended behavior. – sticky May 17 '18 at 17:43