jcw jcw - 1 year ago 95
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?

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download