My decision up to this point is to create a layout where the view takes the same form as the surface view.
Then I get estimates for the preview (in my case, this is the screen size)
//Get our screen size Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE)) .getDefaultDisplay(); DisplayMetrics metrics = getResources().getDisplayMetrics(); Point size = new Point(); try { display.getSize(size); w_width = size.x; w_height = size.y; } catch (NoSuchMethodError e) { w_width = display.getWidth(); w_height = display.getHeight(); }
Then I set the callback:
callback = new Camera.PictureCallback() { @Override public void onPictureTaken(byte[] bytes, Camera camera) {
Thus, basically the surface view never stops showing the preview, but the image hides it so that the user cannot see it.
Then, if the user decides not to save the image, I just hide the view again and the View surface will continue to show a live preview. Fortunately, GS3 does not seem to mind that it calls "camera.startPreview ()"; even when the preview is already taking place.
I really don't like this answer, but everything that I have at the moment works in galaxy S3. He worked on older devices (2.3 and above) that I tried, but this is definitely just a workaround.
source share