Android Roboguice Usage Guide (roboguice) feature description

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.