I am planning to migrate camera api to camerax. Currently I am using SurfaceView to show the camera preview. I noticed that camerax is using PreviewView to show the camera preview. As this library is still in alpha stage, so what is the alternate for that?
I know that previewView internally using SurfaceView/TextureView.
How can I explicitly configure and use SurfaceView/TextureView?
Your best bet is using PreviewView. Managing the Surface correctly requires working around many corner cases. If you insist of writing your own code, please take a look at PreviewView's implementation and start from there.
See: SurfaceView implementation and TextureView implementation