Cannot resolve maketext() method of Toast

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

    First add

     import android.widget.Toast;
    

    statement if you did not already and then

    Toast.makeText(YourActvityName.this, "Your Text", Toast.LENGTH_SHORT).show();
    

提交回复
热议问题