android错误:The method makeText(Context, CharSequence, int) in the type
2016-09-16 18:15
375 查看
错误提示:
The method makeText(Context, CharSequence, int) in the type Toast is not applicable for the arguments (new View.OnClickListener(){}, String, int)
错误原由:在makeText的第一个参数Context指的是上下文对象,而此处上下文并不是该Activity
,你必须使用 自己的Activity.this。如我的是Toast.makeText(MainActivity.this, "已经到了第一周", Toast.LENGTH_SHORT).show() 。
由于本人初写博客,写的不好的地方还请大家能批评指正,希望能和大家相互学习、相互交流、共同成长。
The method makeText(Context, CharSequence, int) in the type Toast is not applicable for the arguments (new View.OnClickListener(){}, String, int)
错误原由:在makeText的第一个参数Context指的是上下文对象,而此处上下文并不是该Activity
,你必须使用 自己的Activity.this。如我的是Toast.makeText(MainActivity.this, "已经到了第一周", Toast.LENGTH_SHORT).show() 。
由于本人初写博客,写的不好的地方还请大家能批评指正,希望能和大家相互学习、相互交流、共同成长。
相关文章推荐
- android错误:The method makeText(Context, CharSequence, int) in the type
- android错误:The method makeText(Context, CharSequence, int) in the type
- android错误:The method makeText(Context, CharSequence, int) in the type
- android错误:The method makeText(Context, CharSequence, int) in the type
- android错误:The method makeText(Context, CharSequence, int) in the type
- android 的The method makeText(Context, CharSequence, int) in the type Toast is not applicable fo(
- The method makeText(Context, int, int) in the type Toast is not applicable for the arguments (new Vi
- 错误:The method replace(int, Fragment) in the type FragmentTransaction is not applicable for the arguments (int, MyFragment)
- 错误:The method replace(int, Fragment) in the type FragmentTransaction is not applicable for the argum
- 关于android创建对话框报错The method setPositiveButton(int, DialogInterface.OnClickListener) in the type Alert
- 关于android创建对话框报错The method setPositiveButton(int, DialogInterface.OnClickListener) in the type Alert
- Android Error - The method replace(int, Fragment) in the type FragmentTransaction is not applicable
- The method setButton(int, CharSequence, Message) in the type AlertDialog is not applicable for the a
- 错误:The method replace(int, Fragment) in the type FragmentTransaction is not applicable for the argum
- The method setPositiveButton(int, DialogInterface.OnClickListener) in the type AlertDialog.
- The method setPositiveButton(int, DialogInterface.OnClickListener) in the type AlertDialog.Builder i
- The method contains(CharSequence) from the type String refers to the missing type CharSequence错误解决方法
- Android 错误 The method onClick(View) of type new View.OnClickListener(){} must override a superclass
- Android 错误 The method onClick(View) of type new View.OnClickListener(){} must override a superclas
- The method setStatus(int) in the type Goods is not applicable for the arguments (Integer)