Friday, 15 April 2011

java - Can Dagger inject an abstract Activity class without injecting the child Activity class? -



java - Can Dagger inject an abstract Activity class without injecting the child Activity class? -

i trying implement dagger in application , have instance need inject field in class within activity class hierarchy children of class not need members injected. hierarchy looks this:

baseactivity -> navigationactivity -> homepageactivity.

i trying inject field in navigationactivity next exception dagger:

java.lang.illegalargumentexception: no inject registered members/com.quidsi.diapers.activity.homepageactivity. must explicitly add together 'injects' alternative in 1 of modules.

my module looks such

@module( injects = navigationactivity.class ) public class gesturemodule { @provides gestureinterface providegestureinterface() { homecoming new mockdrawergesture(); } }

is possible dagger or need inject every kid of navigationactivity?

it not possible dagger 1. have inject subclassed activities well. , yes, unfortunately, means have add together classes injects list in gesturemmodule.

dagger 2 right around corner, maybe things have changed there.

java android dependency-injection dagger

No comments:

Post a Comment