Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Captured image is not getting displayed in android device in Xamarin forms application

keshkesh INMember

I am trying to capture an image using the following code and trying to display the captured image in an image widget, But the image is getting captured but it is not getting displayed in the image widget, please let me know what change should I make:

//code to click pic
await CrossMedia.Current.Initialize();
if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
await DisplayAlert("No Camera", ":( No camera available.", "OK");
var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
Directory = "DiscussionForum",
Name = "test.jpg"
if (file == null)
//await DisplayAlert("File Location", file.Path, "OK");
filePath = file.Path;
fileStream = file.GetStream();
btn_profile_pic.Source = Xamarin.Forms.ImageSource.FromStream(() =>
var stream = file.GetStream();
return stream;


  • AMAXAMAX USMember ✭✭
    edited March 2017

    Try something like this

    filePath = file.Path;
    btn_profile_pic.Source = filePath

Sign In or Register to comment.