protected override void OnActivityResult (int requestCode, Result resultCode, Intent data) { base.OnActivityResult (requestCode, resultCode, data); DBRepository dbr = new DBRepository (); // Make it available in the gallery Intent mediaScanIntent = new Intent (Intent.ActionMediaScannerScanFile); Uri contentUri = Uri.FromFile (Data._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 = _imageView.Height ; Data.bitmap = Data._file.Path.LoadAndResizeBitmap (width, height); if (Data.bitmap != null) { _imageView.SetImageBitmap (Data.bitmap); dbr.updateposimgpath (i,Data._file.Path); Data.bitmap = null; } // Dispose of the Java side bitmap. //GC.Collect(); }