当我从图库上传图像时,代码工作正常,但问题是当我想在另一个活动的imageview中显示图像时
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
{
base.OnActivityResult(requestCode, resultCode, data);
if (resultCode == Result.Canceled) return;
// make it available in the gallery
Intent mediaScanIntent = new Intent(Intent.ActionMediaScannerScanFile);
if (_file != null)
{
Android.Net.Uri contentUri = Android.Net.Uri.FromFile(_file);
mediaScanIntent.SetData(contentUri);
SendBroadcast(mediaScanIntent);
// display in ImageView. We will resize the bitmap to fit the display
// Loading the full sized image will consume to much memory
// and cause the application to crash.
_imageView.SetImageURI(contentUri);
}
}
ContentUri存储实际图像uri,我想在另一个活动中检索它,但我该怎么做?
答案 0 :(得分:0)
尝试使用位图设置imageview。 以下链接可帮助您从相机活动中获取位图