Sachin
Sachin

Reputation: 558

How to use dagger library in android library project?

I want to use dagger library to android library project. I also fallows How to use dagger in a android library project but does not get proper implementation. Anyone has demo or any Ideas about it ? I also want these library classes extends in project for some changes.

Upvotes: 5

Views: 700

Answers (1)

Eugen Martynov
Eugen Martynov

Reputation: 20130

I don't know what the library is, but I would assume most of the code doesn't contain classes with uncontrolled lifecycle (activities, services, fragments, etc.).

If it is true then just use constructors to pass your dependencies.

If it is not then, you have to make a decision who is going to hold knowledge about dependencies graph. A usual solution that context is castable to objects graph knowledge, or it know how to get it. Usually, classes with uncontrolled lifecycle have access to the context

Upvotes: 0

Related Questions