android 调用摄像头
2/7/2017 5:02:32 PM
来源于xamarin开发示例
Button button = FindViewById<Button> (Resource.Id.myButton);
TextView label = FindViewById<TextView> (Resource.Id.lblSuccess);
button.Click += delegate {
var picker = new MediaPicker (this);
if (!picker.IsCameraAvailable)
label.Text = "No camera!";
else {
picker.TakePhotoAsync (new StoreCameraMediaOptions {
Name = "test.jpg",
Directory = "MediaPickerSample"
}).ContinueWith (t => {
if (t.IsCanceled) {
label.Text = "User canceled";
return;
}
label.Text = "Photo succeeded";
Console.WriteLine (t.Result.Path);
}, TaskScheduler.FromCurrentSynchronizationContext());
}
};