Reputation: 420
For example I have next code
public class Class {
@Inject
public void classMethod(SomeObject object) {
//something
}
}
Then I invoke classMethod method got SomeObject instance from graph. But how to run the method, because at the moment I dont have have method arg.
Upvotes: 1
Views: 344
Reputation: 40193
Haven't tried this myself, but my guess is that methods annotated with @Inject
are designed to be called by Dagger only. Example:
class MyFragment extends Fragment {
SomeObject someObject;
@Override
public void onCreate(Bundle saved) {
((InjectorActivity) getActivity()).component().inject(this);
}
@Inject
public void injectSomeObject(SomeObject someObject) {
this.someObject = someObject;
}
}
Would be interested to know if it's indeed working like this.
Upvotes: 1