Skip to content Skip to sidebar Skip to footer

Camera Doesn't Work After Starting Second Activity

I started working with the new camera2 API. I run a camera preview on a TextureView in my first Activity. Via my navigation drawer can I start a second Activity. I want this one to

Solution 1:

Generally, a TextureView tears down its SurfaceTexture output when it is no longer displayed. So when your first Activity goes into the background, the TextureView is no longer a valid target for camera data.

How were you intending to send preview data to your second Activity's TextureView? You'll need to switch the flow of preview buffers to target the second TextureView when the switchover occurs. You can do this by creating a new camera capture session that targets the second TextureView, when you switch to the second activity.

Post a Comment for "Camera Doesn't Work After Starting Second Activity"