Bug 19383 - Take a Picture and Save Using Camera App (Android Recipe)
Summary: Take a Picture and Save Using Camera App (Android Recipe)
Alias: None
Product: Documentation
Classification: Xamarin
Component: Recipes ()
Version: unspecified
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: Amy Burns
URL: http://docs.xamarin.com/recipes/andro...
Depends on:
Reported: 2014-04-29 14:04 UTC by Tyson
Modified: 2014-06-04 07:12 UTC (History)
1 user (show)

Is this bug a regression?: ---
Last known good build:

A fixed version of the Recipe.. (12.66 KB, application/octet-stream)
2014-04-29 14:43 UTC, Tyson

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Tyson 2014-04-29 14:04:04 UTC
PROBLEM: After you take the picture, the application crashes due to a NullPointerException.

In MainActivity.cs:

Line 32:  Uri contentUri = Uri.FromFile(_file);

_file is NULL.

Recipe URL:
Comment 1 Tyson 2014-04-29 14:43:49 UTC
Created attachment 6678 [details]
A fixed version of the Recipe..

I moved the fields (_file, _dir) into a static class (App) and created a static bitmap there as well.

The bitmap needs to be static in order to survive the OnCreate() method, which is  firing AFTER the OnActivityResult() method..

The fact that those events fire in that order seems like a whole other bug in my opinion...
Comment 2 Tyson 2014-04-29 15:00:17 UTC
Actually, the event order was due to me turning the device sideways to take a landscape shot, after starting the application in portait.. disregard that bit..
Comment 4 Amy Burns 2014-06-04 07:12:56 UTC
Added fix and tested. this should be working now with Tyson's fix.