Reputation: 5162
I have written a class with the following constructor
public CustomDialog(Context context)
But when I try to do this in my activity
CustomDialog diag = new CustomDialog(getApplicationContext()){/*stuff here*/};
I get the error The constructor CustomDialog(Context) refers to the missing type Context
What does this mean? And how do I fix it?
Upvotes: 3
Views: 17867
Reputation: 147
I fixed it by adding some code and then removing it again. For example, add an empty statement and then remove it. Eclipse should check for errors again and not find your error.
Upvotes: 0
Reputation: 35997
First you should fix all other errors in your code than you should repeat Project -> Clean in Eclipse to see if the error was fixed.
Upvotes: 5
Reputation: 8685
In case anyone else had this issue: I had the same problem with some code that called a method from the Play Licensing library. I fixed it by using Project > Clean on Play Licensing project (as opposed to the project where the error was showing up).
Upvotes: 7
Reputation: 1006554
What does this mean?
AFAIK, either:
You are missing the import android.content.Context
, or
Your project is messed up, and the compiler cannot find android.content.Context
in your build path
Upvotes: 5