Search code examples
androidxamarin.androidfloating-action-button

FloatActionButton event click


I have an event click BotaoFlutuante_Click but not work to show message and to call my class (work fine to change set image). I don´t know what i´m doing wrong. Can help me?

private void BotaoFlutuante_Click(object sender, System.EventArgs e)
    {
        botaoFlutuante.SetImageDrawable(GetDrawable(Resource.Drawable.iconeverde));
        EnviaSms enviarSms = new EnviaSms();
        enviarSms.EnviarSms();
        Toast.MakeText(Application.Context, "PAPAPAPAPA", ToastLength.Long);
    }

Solution

  • Toast.MakeText(Application.Context, "PAPAPAPAPA", Toast.LENGTH_LONG).show();
    

    You are missing the .show(); syntax and also change the ToastLength.Long into Toast.LENGTH_LONG
    I once also spent hours working with that problem.