Preface (nonsense)
Before we start a new Android app development, we need to create some new directory structures. A good directory structure allows the programmer to see the structure of the application at a glance, helping to help the latter understand the code. I often get a new development requirements for development, there is a feeling that do not know how to start, all the beginning of difficult, considering the later expansion and not be Yimeimei spray, often in the beginning of the creation of the project directory structure will be tangled for a long time (I believe that a lot of novices will have the same mood with me O (∩_∩) o~). This time borrowed some information on the internet and books, I have compiled a generic template, here to make a note, but also for beginners to make a reference.
Statement: Purely personal understanding, there are many areas of insufficient consideration, and we also invite you to criticize.
Business:
First:
Again explained:
Com.movitech.nickframe:movitech (company domain name), nickframe (application name)
Com.movitech.nickframe.
About: Other contents of the project
Common.: Store some tool classes, some custom view of this application, etc.
Adapter: Storage of adapter classes needed in activity
Util: Storing tool classes, such as tool classes for parsing server data
View: A custom view to store in this app
Config: Store the application's root configuration, such as version, directory configuration, etc.
Constant: public static final constant, define state, type, etc.
DB: Storing database related classes
Entity: The entities used in the application of the class, to Xxx+info named class, the personal feel that this name more vivid and real
Module: This is the application development of the main module, under which the development of functional modules can be divided, this example is just a few examples, the specific can be based on
Application of the actual business to build the child package
BBS: The application of BBS module, can re-create such as Activity,service, such as sub-package, based on the actual business creation
Blog: Application of the blog module, with BBS
Person: Application of the personal module, with BBS
Baseactivity.java the custom base class for all activity in the app, you can do some common things
The entry class for the Mainactivity.java application can also be put into a specific function module
Baseapplication.java Application Management class, do some basic initialization or configuration that all apps will use. Application of other applications should then be
It is inherited by this baseapplication
For reference, take a look at the pictures on the Internet:
The Appconfig.java under the config package holds the root configuration of the application, such as the version, directory configuration, and so on.
Module package is divided into various modules, blogs for the blog module, BBS for the Forum module, person for the whole station personal information module, widget represents a special function module.
The common package contains some tool classes, some custom view of the application, and so on.
1). function modules and type modules can be divided, if not required, the partition of the module can be omitted.
2). The component Division of activity and service, if not required, can be omitted.
3). All divisions, if not required, can be omitted.
Android application directory structure Framework build