[mono-android] taking a pic
Wally McClure
theevilprogrammer at hotmail.com
Thu Jan 19 21:08:11 UTC 2012
I've got the code below for taking a picture. It uses the phone's camera. It works on my phone, but not on a xoom and not on some other people's camera. What I am finding is that the data.Data property that comes back is null on a device that it doesn't work on. Here are the devices I've tested with:
htc evo 4g running 2.3 - works
motorola xoom running 3.2 - does not work
motorola xoom running 4.03 ics - does not work
droid bionic running 2.3 - does not work
Anyone have a suggestion regarding this? Is the default came activity a bad one to use?
private void saveFullImage() {
Intent intent = new Intent(Android.Provider.MediaStore.ActionImageCapture);
StartActivityForResult(intent, TAKE_PICTURE);
}
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
{
base.OnActivityResult(requestCode, resultCode, data);
if (requestCode == TAKE_PICTURE)
{
Android.Net.Uri dataUri = data.Data;
var imageView = FindViewById<ImageView>(Resource.Id.takepic);
imageView.SetImageURI(dataUri);
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/monodroid/attachments/20120119/8fa655c3/attachment.html>
More information about the Monodroid
mailing list