I can confirm that the sample does work on the Galaxy Nexus, so this is probably a hardware specific thing
On Tue, May 7, 2013 at 4:34 AM, Igor Velikorossov <russ...@gmail.com> wrote: > I've recently observed similar issues. > > First of all there seems to be reports that different devices may be to > blame. Samsungs are notorious for such bug > http://stackoverflow.com/questions/7031374/photo-capture-intent-causes-nullpointerexception-on-samsung-phones-only/7031422#7031422 > > Secondly, and that I have observed on Samsung Galaxy2, when taking picture > and rotating the device before accepting the image, it may lose the image > and result in _file == null. > There are plenty of discussions on stackoverflow about this as well. > > I have mitigated this issue with the following code: > > > if (this.file == null) > { > // find the last image taken > string[] p1 = new string[] { > > MediaStore.Images.ImageColumns.Id, > > MediaStore.Images.ImageColumns.DateTaken, > > MediaStore.Images.ImageColumns.Data, > }; > using (var cursor = > this.ContentResolver.Query(MediaStore.Images.Media.ExternalContentUri, p1, > null, null, p1[1] + " DESC")) > { > if (cursor.MoveToFirst()) > { > var c = cursor.GetString(2); > this.file = new File(c); > } > } > } > > > Hope this helps. > Igor > > > On 7 May 2013 04:47, <monodroid-requ...@lists.ximian.com> wrote: > >> ---------- Forwarded message ---------- >> From: Massimiliano Fabbri <ma...@doxamedia.com> >> To: Discussions related to Mono for Android <monodroid@lists.ximian.com> >> Cc: >> Date: Mon, 06 May 2013 19:09:36 +0200 >> Subject: [mono-android] Camera get photo sample >> I'm following the camera photo sample from here: >> >> http://docs.xamarin.com/recipes/android/other_ux/camera_intent/take_a_picture_and_save_using_camera_app >> >> The issue I got is the _file variable is always null!! >> the _dir variable is ok. >> >> Where I'm wrong ? >> >> Java.IO.File _file; >> Java.IO.File _dir; >> >> private void TakeAPicture(object sender, EventArgs eventArgs) >> { >> Intent intent = new Intent(MediaStore.ActionImageCapture); >> >> _file = new Java.IO.File(_dir, >> String.Format("myPhoto_{0}.jpg", Guid.NewGuid())); >> >> intent.PutExtra(MediaStore.ExtraOutput, >> Android.Net.Uri.FromFile(_file)); >> >> StartActivityForResult(intent, 100); >> } >> >> >> ........... >> ........... >> protected override void OnActivityResult(int requestCode, Result >> resultCode, Intent data) >> { >> base.OnActivityResult(requestCode, resultCode, data); >> >> if (requestCode == 100 && resultCode == Result.Ok) >> { >> if (_file != null) <----------- Is always False!!! >> > > > > _______________________________________________ > Monodroid mailing list > Monodroid@lists.ximian.com > > UNSUBSCRIBE INFORMATION: > http://lists.ximian.com/mailman/listinfo/monodroid > -- http://www.opgenorth.net _______________________________________________ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid