Android Project Subcontracting---summary-------direct use

Source: Internet
Author: User

Note:This article is a excerpt from this article. Simply put, it is read the article, and then, repeat their own, copy form the article. 1. List the subcontracting rules for Android projectsMicro disk using subcontracting rules as follows: 1). First tier Com.sina.VDisk:com.sina (company domain name) +app (application name). Use the company domain name + application name. 2). Second layer, each module name (containing the entity module). If a module (main module) has sub-modules, then the corresponding base class, such as Baseactivity, is defined in the main module. Vdiskclient is a function module; Vdiskserver is a function module. The entity module defines the corresponding entity class for global invocation. The name of the entity class Xxx+info. 3). The third layer, a specific module is then sub-package, or contain specific classes.the subcontracting rules of NetEase newsBy component type, components of the same type are placed under the same package.     For example, the activity package, the main storage is the type of activity class. 1). The first layer, Com.netease, uses the company domain name. 2). Second layer, block, piece is newsreader, this piece below is the content of NetEase news. Mobileanalysis, is estimated to be a common package. 3). Third layer, the green part, according to the component type subcontracting, Activity,service,appwidget,db,bean these packages to store the corresponding type of class. “often activity-related classes such as listeners, threads, adapters and many other classes, these are not directly in the activity package , but directly written in the corresponding activity in the form of anonymous or internal class definition, Otherwise the activity Pack and service pack will look cluttered. ”a subcontracting rule that aggregates the advantages of the above-mentioned subcontracting rulesSuitable for multi-application development Reader,frind,life, these three packages, representing the corresponding application. Com.tianxia is the first tier, limited by company name. “where the common package is shared for these three applications, Config,oauth is optional, view holds some of the most common custom view, such as dialog box, custom list, etc. ", common is extracted from these three applications and can be shared in these three applications. Common is a jar package. Consider that multiple applications will refer to a library project (Adnroid Library) using the following sub-package: "

where baseapplication does some basic initialization or configuration that all apps will use . The application of other apps should inherit this baseapplication later.

Base is an Android library and a complete Android project , and Common is just a jar file, but you can also develop it as an Android library if you need it. Other main engineering Reader,friend,life should refer to the base project .

"InThird Floor, list the parts of the project that you want to divide, the functional modules module, and the Config;common section of the configuration section, where common is only common to the application, storing the features and classes commonly used in the application. Under an application, according to the module, the fourth layer,according to the function module Division: As below, under the module package, divided the Blog,bbs,person three function modules, the widget is a special function module, Baseactivity is the module under the common base class.one more layer .: Under a specific module, it is also possible to subcontract according to the component type (for example, by Activity,service the two major component types). --------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------Final Summary:For the development of an application, I will change the sub-rules of NetEase news, and then use. As follows: The first layer uses the COM + company domain name, and the second tier is the name of the app. The third layer is divided by component type, for example, the activity type is placed under the activity package, and the Serveice type is placed under the service package. Then, an activity uses the Adapter,listener as the inner class of the activity.   Naming rules: Entity classes, followed by the Xxxinfo;activity,service,receiver component, are named after Xxxactivity,xxxservice, and then the app can reference the library project (Android Library). If you are developing multiple application management, use the [a subcontracting rule that aggregates the advantages of the above-mentioned subcontracting rules] to subcontract. Reference article: http://mobile.51cto.com/abased-386212.htm

Android Project Subcontracting---summary-------direct use

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.