Project
Mobile Client Search
Project package structure, log, code description
Author
Zeng Jinlong
Time
2014-10-13
Description
Brief description of engineering structure, use of log4j log system and UTF-8 encoding
The first part: solve the problem of engineering garbled
Creating a project under Windows is GBK encoded by default. And the general Internet company (Thunder, including I know Baidu, etc.) are used UTF-8 encoding. Therefore, under the Windows environment open our project will appear garbled, our app is garbled. So you need to change the encoding method to UTF-8. The steps are as follows
Right-click the project (Seller,expandtabview, etc.), select the Properties menu, the first option in the Popup dialog box resource, such as: In the text file encoding, select UTF-8)
Note: My is the Ubuntu system, the default is utf-8,windows may want from other inside to choose UTF-8, specific own groping, not difficult).
At this point, the coding problem is resolved. Future projects are developed using UTF-8. General.
Part II: Log system
1) Android.util.Log
The log is made up of two parts here. Part of the android.util.log,android default, it can be the log into the Ddms logcat inside, for us to observe in real time. This is also the most important method of logging in our development. Quick location problem.
2) log4j.
Logcat log will be washed away, for some deep logic problems, rather than programming problems, the general Internet companies will use the output log to the file system and further sent to a log server. The search is using log4j log output system, in the project/libs/can see that there are two jar library is log4j.
LOG4J initialization configuration, in the file Com.souya.seller.app package sellerapplication file in the setuplog4j () method is configured, the specific look at the code, so that in the app launch, the log system is configured.
Log4j is not a big part of it, but it's a complete app that requires it to stand up first. The subsequent complications will be used. Observing a few 10 trillion or even hundreds of trillion log pairs and locating the complex problems that are not necessary will often come across.
About log4j, there are also information available on the Internet.
Part III: Package structure
As shown, simply describe the structure of the existing package
Seller: Contains several important activity, the following activity try not to put here.
The global class within the App:app range.
Askbuy: Users buy
Askbuy.widget: User-Wanted UI components
Basic classes of base:fragment and activity
Cache: Picture Caching system
Clothmanager: Cloth Management
Data: It is primarily data processing that deals with servers.
Database: Databases related to local SQLite.
Exception: Exception handling
Hotsearch: Popular Search
Misc: constant
Module: Modules. The main use of third-party libraries or our subsequent libraries, upgrade libraries and so on.
Search: Searches related, searches on Actionbar, and automatically prompts for features.
Upload: Upload
Util: Tools
Widgets: Common UI components.
q& A
1: Does this package have a reasonable structure?
A: Unreasonable, follow-up will continue to optimize, but for the time being to do so, after all, refactoring is built on the code of a lot of driving to make sense.
2: Why so many bags?
A: The subsequent use of buyers and sellers to put in a piece. For such a functional page such as Clothmanager, or will maintain a feature page a package design, each package will not exceed 10 files, a logical glance.
Android Development Search YA Project----Project Structure description