Cannot resolve maketext() method of Toast

后端 未结 18 2421
旧时难觅i
旧时难觅i 2021-02-07 02:02

I am getting error while creating a Toast

Toast toast = Toast.makeText(this, text, duration);

I am getting cannot resolve ma

18条回答
  •  佛祖请我去吃肉
    2021-02-07 02:20

    I have faced a similar problem but in my case i found out that Xamarin c# and Java in Android studio have differences when calling some functions(same functions).

    When using Xamarin and c#, then makeText becomes MakeText and show becomes Show as shown below:

    Toast toast = Toast.MakeText(this, "Text", ToastLength.Long);
    toast.Show();
    

    Hope this helps:)

提交回复
热议问题