i am using the CameraPreview.java and it works well, but
but it got a white vertical edge on the screen of the right. And your sample works well, it's kind of weird.
Same here. I too got a vertical edge on the screen of the right
Same here as well. I don't know the right solution, but it is mainly started at the line highlighted below in CameraPreviewSample.java

It ends up requesting a resize of the SurfaceView to better maintain the aspect ratio. The result is that the SurfaceView no longer fills/matches the parent's width (58 pixels skinnier in my case). I ended up commenting that line and the result is no white bar and the image looks good enough, for now.
to remove white space from right , just hide statusBar