Do you mean "
Preview.setSurfaceProvider with null SurfaceProvider" is not working?
I gave a try on current latest
CameraXBasic (CameraX 1.0.0-beta10 and view 1.0.0-alpha17)
and modify the ImageButton onClick behavior as
controls.findViewById<ImageButton>(R.id.camera_capture_button).setOnClickListener {
if (hasSetSurfaceProvider) {
preview?.setSurfaceProvider(null)
} else {
preview?.setSurfaceProvider(viewFinder.surfaceProvider)
}
hasSetSurfaceProvider = !hasSetSurfaceProvider
}
and it seems to work.
Could there be other reason to cause it fail? Maybe some code snippet can help to figure it out.