Android の Intent
Intentで情報を伝える | TechBooster http://techbooster.org/android/application/17324/
UWPの共有みたいなものか。
private void Btn_Click(object sender, EventArgs e) { Intent intent = new Intent(MediaStore.ActionImageCapture); file = new File(dir, String.Format("myPhoto{0}.jpg", Guid.NewGuid())); intent.PutExtra(MediaStore.ExtraOutput, Android.Net.Uri.FromFile(file)); StartActivityForResult(intent, 0); }
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data) { base.OnActivityResult(requestCode, resultCode, data);
// Make it available in the gallery
Intent mediaScanIntent = new Intent(Intent.ActionMediaScannerScanFile);
var 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.
int height = Resources.DisplayMetrics.HeightPixels;
int width = image1.Height;
bitmap = _file.Path.LoadAndResizeBitmap(width, height);
if (bitmap != null)
{
image1.SetImageBitmap(bitmap);
bitmap = null;
}
// Dispose of the Java side bitmap.
GC.Collect();
}