示例#1
0
 public void SurfaceCreated(ISurfaceHolder holder)
 {
     try
     {
         // if only front camera, get it
         camera = Camera.Open(0);
         Camera.Parameters p = camera.GetParameters();
         p.PictureFormat = Android.Graphics.ImageFormatType.Jpeg;
         camera.EnableShutterSound(true);
         // fix camera rotation
         camera.SetDisplayOrientation(0);
         camera.SetParameters(p);
         camera.SetPreviewCallback(this);
         camera.Lock();
         camera.SetPreviewDisplay(holder);
         camera.StartPreview();
     }
     catch (Java.IO.IOException e)
     {
     }
 }