Code example for SurfaceHolder

Methods: getSurface

0
 
    return(result);
  } 
 
  private void initPreview(int width, int height) {
    if (camera != null && previewHolder.getSurface() != null) {
      try { 
        camera.setPreviewDisplay(previewHolder);
      } 
      catch (Throwable t) {
        Log.e("PreviewDemo-surfaceCallback",
              "Exception in setPreviewDisplay()", t);
        Toast.makeText(PictureDemo.this, t.getMessage(),
                       Toast.LENGTH_LONG).show();
      } 
 
      if (!cameraConfigured) {
        Camera.Parameters parameters=camera.getParameters();
        Camera.Size size=getBestPreviewSize(width, height, parameters);
        Camera.Size pictureSize=getSmallestPictureSize(parameters);