Repository navigation
RoboGuice in @EBean
Since AndroidAnnotations 2.4
Suppose you have an @EBean component, and you would like to inject some of its members with RoboGuice.
Activities with @EActivity allow RoboGuice injection thanks to the @RoboGuice annotation. But we implemented the support for RoboGuice long before implementing @EBean, so RoboGuice support is only for activities right now. We don't want to put too much effort in RoboGuice for now, because it will probably change the whole implementation.
This doesn't mean you can't use RoboGuice in your @EBean classes, you just need to require manual injection from Guice, quite in the same way it's done in RoboActivity.
Here is an example:
@EBean
public class MyBean {
@App
MyRoboApplication application;
@Inject
SomeClass myRoboGuiceDependency;
@AfterInject
void injectRoboGuiceDependencies() {
application.getInjector().injectMembers(this);
}
} AndroidAnnotations was created by Pierre-Yves Ricau and was originally sponsored by eBusinessInformations.
10/07/2015 The 3.3.2 release is out !
- Get started!
- Download
- Cookbook, full of recipes
- Customize annotation processing
- List of all available annotations
- Release Notes
- Examples
- Read the FAQ
- Join the Mailing list
- Create an issue
- Tag on Stack Overflow
- Ask on Gitter