I'm working on Xamarin Android project and I want to implement taking photo with MvvmCross.
Here's my code:
public class PhotoService:IPhotoService { private const int MaxPixelDimension = 1280; private const int DefaultJpegQuality = 90; private Stream imageStream; public Stream ImageStream { get { return imageStream; } set { imageStream = value; } } public void GetPhoto() { var task = Mvx.Resolve<IMvxPictureChooserTask>(); task.TakePicture( MaxPixelDimension, DefaultJpegQuality, SavePicture, null); } private void SavePicture(Stream stream) { ImageStream = stream; } } but in:
task.TakePicture( MaxPixelDimension, DefaultJpegQuality, SavePicture, null); I have error:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
UPDATE
in call stack I have:
0x0 in Android.Content.Intent..ctor at /Users/builder/data/lanes/3511/501e63ce/source/monodroid/src/Mono.Android/platforms/android-24/src/generated/Android.Content.Intent.cs:1275,6 C# 0x12 in MvvmCross.Plugins.PictureChooser.Droid.MvxPictureChooserTask.TakePicture C#
0x3A in App.Services.PhotoService.PhotoService.GetPhoto at C:\app\App.Services\PhotoService\PhotoService.cs:38,4 C#
0x7 in App.ViewModels.ViewModels.MainViewModel.TakePhoto at C:\app\App.ViewModels\ViewModels\MainViewModel.cs:49,4 C#