本文整理汇总了C#中Android.Hardware.Camera.Release方法的典型用法代码示例。如果您正苦于以下问题:C# Camera.Release方法的具体用法?C# Camera.Release怎么用?C# Camera.Release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Hardware.Camera
的用法示例。
在下文中一共展示了Camera.Release方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SurfaceCreated
public void SurfaceCreated(ISurfaceHolder holder)
{
// The Surface has been created, acquire the camera and tell it where
// to draw.
camera = Camera.Open ();
try {
camera.SetPreviewDisplay (holder);
} catch (Exception) {
camera.Release ();
camera = null;
// TODO: add more exception handling logic here
}
}
示例2: CreateCamera
private bool CreateCamera(int cameraIndex)
{
#if !DEBUG
try
#endif
{
StopCamera();
_camera = Camera.Open(cameraIndex);
_camera.SetPreviewDisplay(_surfaceHolder);
if (OnCameraCreated != null)
{
if (_cameraInfo == null)
_cameraInfo = new Android.Hardware.Camera.CameraInfo();
Camera.GetCameraInfo(cameraIndex, _cameraInfo);
OnCameraCreated(this, new CameraInfoEventArgs(_camera, _cameraInfo));
}
}
#if !DEBUG
catch (Exception excpt)
{
_camera.Release();
_camera = null;
while (excpt.InnerException != null)
excpt = excpt.InnerException;
Report.Error(Context.PackageName, String.Format("Unable to create camera: {0}", excpt.Message));
return false;
// TODO: add more exception handling logic here
}
#endif
return true;
}