"Skipped 76 frames" in Xamarin.Android

3

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);
}
    
asked by Javier Escobar Espinoza 04.10.2016 в 00:59
source

2 answers

2

Young, and if you do the following, I say: D!

    
answered by 04.10.2016 / 07:50
source
0

Javier, these messages are displayed on the console using Xamarin or Android Studio, to a certain extent this is probably not causing a problem in the execution of your application, but I give you two important causes that cause the deployment of these messages.

  • One reason is that the resources or media that your application tries to load are "heavy".
  • Make sure your process is running outside the main thread ( Main Thread )
answered by 04.10.2016 в 02:01