android - Using Roboguice to inject a dependency that does not have a default constructor -
if have class single constructor, how can roboguice inject activity?
the service injected:
public flightmanager(context context){ //do context } the activity:
public class recordflight extends roboactivity { @injectresource flightmanager manager; //whatever code here } the dependency context, gather should injected without problem. additoinally, of other usages, such @injectview , @inject of classes default constructor seem fine, usage above kills app without giving me stack trace.
any ideas?
thanks
jon
mark constructor @inject annotation:
@inject public flightmanager(context context){ //do context } then inject flightmanager so:
public class recordflight extends roboactivity { @inject flightmanager manager; //whatever code here } @injectresource not necessary here, since it's regular java class you're injecting, not android resource.
Comments
Post a Comment