Ioc configuration dependency:
@ InjectView (R. id. hello) TextView helloLabel;
@ InjectResource (R. drawable. icon) Drawable icon;
@ Inject LocationManager loc;
The module is the basic construction block for Guice to construct the Object Graph. The construction of the object Graph in Guice is completed by a class called "Injector.
Guice is a subclass of AbstractMoudule in the module, while RoboGuice is a subclass of AbstractAndroidModule in the module. RoboGuice uses Injector to create the dependent object, and Injector constructs the relationship diagram between classes by referring to the Bindings defined in Module. In some cases, if you want to use Injector directly, you can use getInjector () of RoboActivity ().
For example
[Java]
Injector injector = getInjector ();
LocationManager loc = injector. getInstance (LocationManager. class );
Example
[Java]
Public class SayModule extends AbstractAndroidModule {
@ Override protected void configure (){
Bind (ISayService. class). to (SayHello. class );
}
}