Building a Camera App in Mono for Android: Listing 2

Updating OnActivityResult().

protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
    {
        base.OnActivityResult(requestCode, resultCode, data);

        if (requestCode == TakePictureRequestCode)
        {
            var picture = FindViewById<ImageView>(Resource.Id.Picture);

            using (var image = MediaStore.Images.Media.GetBitmap(ContentResolver, _pictureFileUri))
            {
                picture.SetImageBitmap(image);
            }

			var broadcastIntent = new Intent(Intent.ActionMediaScannerScanFile);
			broadcastIntent.SetData(_pictureFileUri);
			SendBroadcast(broadcastIntent);
        }
    }

About the Author

Greg Shackles, Microsoft MVP, Xamarin MVP, is a Principal Engineer at Olo. He hosts the Gone Mobile podcast, organizes the NYC Mobile .NET Developers Group, and wrote Mobile Development with C# (O'Reilly). Greg is obsessed with heavy metal, baseball, and craft beer (he’s an aspiring home brewer). Contact him at Twitter @gshackles.