我用以下构造函数编写了一个类
public CustomDialog(Context context)
但是当我尝试在我的活动中这样做时
CustomDialog diag = new CustomDialog(getApplicationContext()){/*stuff here*/};
我得到错误The constructor CustomDialog(Context) refers to the missing type Context
这是什么意思?我该如何解决?
我用以下构造函数编写了一个类
public CustomDialog(Context context)
但是当我尝试在我的活动中这样做时
CustomDialog diag = new CustomDialog(getApplicationContext()){/*stuff here*/};
我得到错误The constructor CustomDialog(Context) refers to the missing type Context
这是什么意思?我该如何解决?
万一其他人有这个问题:我在调用 Play Licensing 库中的方法的一些代码中遇到了同样的问题。我通过使用Project > Clean on Play Licensing 项目修复了它(与出现错误的项目相反)。
这是什么意思?
AFAIK,要么:
您缺少import android.content.Context, 或
android.content.Context你的项目搞砸了,编译器在你的构建路径中找不到
首先,您应该修复代码中的所有其他错误,而不是在 Eclipse 中重复 Project -> Clean以查看错误是否已修复。
对项目进行了 Maven 更新,它对我有用。
我通过添加一些代码然后再次删除它来修复它。例如,添加一个空语句,然后将其删除。Eclipse 应该再次检查错误并且找不到您的错误。
项目->清洁对我有用。