I am developing an application in Xamarin.Android where I use Media Plugin
to capture a photo and send it as a parameter to another Activity
, but when I take the photo and give it OK, there is a moment when it is shown a screen like this:
And in the logcat it appears:
skipped 76 frames the application may be doing too much work on its main thread
How to fix it? I do not think the code I'm using does a very heavy job, am I wrong? The method is as follows:
private async void TakePhotoBtn_Click(object sender, EventArgs e)
{
if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
{
Toast.MakeText(this.ApplicationContext,
"La cámara no está disponible",
ToastLength.Long).Show();
return;
}
var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions()
{
DefaultCamera = Plugin.Media.Abstractions.CameraDevice.Rear,
SaveToAlbum = false
});
if (file == null)
return;
Intent i = new Intent(this, typeof(ResultActivity));
i.PutExtra("Image", file.Path);
StartActivity(i);
}