Cannot resolve maketext() method of Toast

后端 未结 18 1140
南笙
南笙 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:34

    Just like Blackbelt said the syntax of Toast is as follows:

    Toast.makeText(Activity.this, "Message",Toast.).show();
    

    where Activity.this is the current activity, Message is the string you want to show and Toast.length is the length you want it to show it for.

提交回复
热议问题