Cannot resolve maketext() method of Toast

后端 未结 18 2592
旧时难觅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

    If you are trying to Toast your text in the MainActivity then do this:

    Toast.makeText(getApplicationContext(), "Your text", Toast.LENGTH_LONG).show();
    

提交回复
热议问题