调用相机:
Intent intent = new Intent(MediaStore.ActionImageCapture); StartActivityForResult(intent, 13); protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data) { base.OnActivityResult(requestCode, resultCode, data); var bitmap = (Bitmap)data.Extras.Get("data"); }
调用相册:
Intent intent = new Intent(Intent.ActionGetContent,null); intent.SetDataAndType(MediaStore.Images.Media.ExternalContentUri, "image/*"); StartActivityForResult(intent, 14); protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data) { base.OnActivityResult(requestCode, resultCode, data); var bmp = Android.Provider.MediaStore.Images.Media.GetBitmap(this.ContentResolver, data.Data); }