jcw jcw - 1 month ago 9x
Android Question

Constructor refers to missing type context

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?


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