android错误:The method makeText(Context, CharSequence, int) in the type

来源:互联网 发布:淘宝买大麻暗语2016 编辑:程序博客网 时间:2024/05/01 18:40

错误提示: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() ;

原创粉丝点击