|
Installation
Downloading and Installing
Installation
Your First RoboGuice Application!Create a new class that extends RoboApplication (let's call it MyApplication). Update the android:name attribute of application in the AndroidManifest.xml to set your newly created application. For instance, in our example it would be : <application android:name="com.mycompany.myproject.MyApplication" ... > Create a configuration Module class that extends AbstractAndroidModule (let's call it MyModule). Implement the configure() method to add your own bindings. See the Google Guice Wiki to learn more about configuring Modules. Override RoboApplication.addApplicationModules(List<Module>) method in your application class. Add a new instance of your custom Module to the list. For instance : public class MyApplication extends RoboApplication {
protected void addApplicationModules(List<Module> modules) {
modules.add(new MyModule());
}
}Make your activities extend from RoboActivity instead of Activity. You are ready to start using RoboGuice! To see examples of what you can do, check out the example in the samples directory. | |