question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] Asus zendfone 2: cannot update image after capturing by camera

See original GitHub issue

Bug

Version Number of Plugin: 2.6.0 Device Tested On: Asus Zendphone 2 (android 5.0) Simulator Tested On:

Expected Behavior

When I capture image, or pick image from gallery, the image should be updated to the image view.

Actual Behavior

Nothing was updated because the content page was reinitialized.

Steps to reproduce the Behavior

  1. Create a screen, then add a button, a image view to the screen. Add these below codes after in the constructor of the content page.
  2. Run or debug program to device, then press capture button, or pick button to get image.
takePhoto.Clicked += async (sender, args) =>
{
    await CrossMedia.Current.Initialize();

    if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
    {
        DisplayAlert("No Camera", ":( No camera available.", "OK");
        return;
    }

    var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
    {
        Directory = "Sample",
        Name = "test.jpg"
    });

    if (file == null)
        return;

    await DisplayAlert("File Location", file.Path, "OK");

    image.Source = ImageSource.FromStream(() =>
    {
        var stream = file.GetStream();
        file.Dispose();
        return stream;
    }); 

    //or:
    //image.Source = ImageSource.FromFile(file.Path);
    //image.Dispose();
};

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jamesmontemagnocommented, Feb 18, 2017

Are you sure you don’t have kill activity on in your developer options?

Or try to add this line in your MainActivity: https://github.com/xamarinhq/app-evolve/blob/master/src/XamarinEvolve.Android/MainActivity.cs#L38

0reactions
jamestran1commented, Feb 18, 2017

@jamesmontemagno Thank you, I resolved this problem. It because I checked on Kill Activity on Developer Option as you said before 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Phone] Troubleshooting - I cannot launch the Camera
1. Reboot your phone/pad and launch the camera again. · 2. Clear the camera data and cache : Go to Settings -> Apps...
Read more >
Pictures Taken with Camera Doesn't Save in Gallery [Fixed]
Do you get unwanted issues with your phone, like the pictures taken with camera don't save in Gallery? Get the ways to fix...
Read more >
ZenFone 2 Laser (ZE600KL) - Support
1.Fix the several issue in Line. · 2.Fix no LED Indicator option · 3.Fix unavailable to read photos which stored in Image Library...
Read more >
Android Camera Not Working? 6 Common Issues and ...
3. The Camera App Is Missing on the Phone · Open the Settings app on your Android device. · Go to Apps. ·...
Read more >
Snapchat bug?
Whenever I take a picture using the back camera and flash, the picture never gets taken? The camera just stays there with no...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found