I am trying to use an intent to get a picture from the camera to my
application. Both the Intent data parameter to OnActivityResult is null and
any member variable in my Activity that I use to store a Uri is null. So how
do I access the image taken? I have tested on a device with camera.

Heres my code:

public void BtnCameraClick(object sender, EventArgs eventArgs)
{
    var uri = ContentResolver.Insert(isMounted ?
MediaStore.Images.Media.ExternalContentUri
                                              :
MediaStore.Images.Media.InternalContentUri, new ContentValues());
    _imageUri = uri.ToString();
    var i = new Intent(MediaStore.ActionImageCapture);
    i.PutExtra(MediaStore.ExtraOutput, uri);
    StartActivityForResult(i, CAPTURE_PHOTO);
}

protected override void OnActivityResult(int requestCode, Result resultCode,
Intent data)
{
    // data is null
    // _imageUri is also null
    if (resultCode == Result.Ok && requestCode == CAPTURE_PHOTO) {
                                var imageView = 
FindViewById<ImageView>(Resource.TipScreen.image);
                                imageView.SetImageURI(Uri.Parse(_imageUri));
}

Is there a working example of camera intent somewhere?


--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/Cant-receive-picture-from-Camera-intent-tp5081059p5081059.html
Sent from the Mono for Android mailing list archive at Nabble.com.
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to