The previous use of the Android Roboguice Guide (1): An overview of the corresponding Roboguice did a brief introduction, followed by the introduction of Google Guice basic usage, Roboguice is basic Android and Google Guice developed Dependency Injection Development kit for the Android platform, the following diagram provides a basic block diagram for using the Roboguice development application:
Android apps can directly use Google Guice to inject operations on generic classes, while the classes associated with Android platforms such as Activity,context,service,view can be injected using Roboguice.
In the example Android Roboguice use Guide (2): The first example Hello World introduces the steps to use Roboguice development, classes that originally derive from activity generally need to be derived from roboactivity, and add classes derived from Roboapplication as the application class for the application application, and the detailed corresponding table is as follows:
The tags supported by Roboguice are as follows:
@ContextScoped: Scope for context scope Android Roboguice usage Guide (one): scopes
@InjectExtra: Getextra injection mark for intent
@InjectPreference: Inject Preference
@InjectResource: Inject resource, such as drawable, icon, etc.
@InjectView: Inject View
@Inject: Guice tags, can be injected into the Android platform to support a variety of services, such as Locationmanager.
@SharedPreferencesName: sharedpreferences name, etc.
In addition, Roboguice also provides a simple message publish/subscribe mechanism, and can support dependency injection robothread, Roboasynctask, Robolooperthread, etc. will be explained in detail later in the article.
View a full set of articles: Http://www.bianceng.cn/OS/extra/201301/34950.htm