Google Guice on Android (Roboguice)Introducing Google's open-source framework today, Roboguice, is almost the same as the dagger framework that was described earlier, just as dagger is more powerful than its function.
Dagger achieves better performance in a different way by focusing on a simplified set of features. Some people think roboguice save a lot of time. Fewer of the code means fewer errors. Fewer boilerplate code means that you can put a lot of other time into your application's core logic. So that's why we're using these open source frameworks for development. Here's what we say about the use of Roboguice:
views Injection: @InjectView (r.id.textview1) TextView textView1;//So we get this TextView object entity , &NB Sp
resources injection:   getresources (). getdrawable (R.id.ic_launcher) , instead of using @InjectResources annotations, such as: @ Injectresource (r.id.ic_launcher) drawable iclauncher ; , &NB Sp , &NB Sp
System Services Injection: get some system-level service objects and no longer follow the original
Locmanager = (locationmanager) getsystemservice (Activity.location_service), the method is implemented using @inject annotations, such as:
@Inject
locationmanager Locmanager;
POJO Object injection: injecting A simple Java object (POJO) is also @inject with annotations, such as: @Inject Student Student;
in fact, very many people feel that roboguice is very inefficient, so very few people are willing to use this, and many others tend to use AA (Android Annotation).
Of Course there are other annotations in Roboguice:such as:@ContentView (R.layout.layout_main) replaces Setcontentview (r.layout.layout_main);@ContextSingleton to design a singleton class. (In fact, in dagger)suppose netizens are interested. Go deeper into its Java Doc (http://www.imobilebbs.com/download/android/roboguice/javadoc/)
Butter KnifeThis framework is the same as the use of the Roboguice framework. By the way, record a little bit. Examples:
class exampleactivity extends Activity { @InjectView(R.ID.User) EditText username; @InjectView(R.ID.Pass) EditText Password; @OnClick(R.ID.Submit) void Submit() { //TODO call Server ... } @Override Public void onCreate(Bundle savedinstancestate) { Super.onCreate(savedinstancestate); Setcontentview(R.Layout.simple_activity); Butterknife.Inject( This); //TODO use ' injected ' views ... }}
configuration in Gradle:
Compile ' com.jakewharton:butterknife:5.1.1 '
Android Roboguice Open source framework, Butter Knife Open source Framework analysis