Open Harmeetkaur01 opened 6 years ago
You have to inject the generated dagger component into APIHandler into order to use @inject annotation. In APIHandler constructor you should add something like :
DaggerApplicationComponent.builder()
.androidSupportInjectionModule(...)
.applicationModule(...)
.activityBuilder(...)
.build().inject(this);
Hi , I'm currently using dagger 2 in my project. I'm unable to access injectable class through @Inject in non activity/fragment class. I have a handler class and want to use injectable in that class. Can u help me how to do this.
This is my ApplicationComponent class I added a method inject(APIHandler apiHandler) in this and tried getting @injent DataManager dataManager(injectable class) in ApiHandler class but getting it null, any other thing i need to do in APIHandler class.Let me know if i m missing something where as i m able to get it in activity and fragment
APIHandler class