Dagger 2 how to perform constructor injection

Viewed 7591

I have a class

public class DialogUtils
{
    private Context context;

    @Inject
    public DialogUtils(Context context)
    {
        this.context = context;
    }
}

In my activity class i have did but i'm getting null pointer exception on dialogUtils instance.

public class LoginActivity extends Activity{
@Inject DialogUtils dialogUtils;
}

I know how to inject dependency via module and component but not sure how to with construction injection. Any help is much appreciated.

2 Answers
Related