Search for Ya project for Android development-Project Structure Description
Project
Search bud mobile client
Project package structure, logs, Code Description
Author
Zeng Jinlong
Time
2014-10-13
Description
Briefly describe the engineering structure, use the log4j log system and UTF-8 code
Part 1: solving engineering garbled issues
By default, projects created in windows use GBK encoding. And General Internet companies (thunder, including I know Baidu, etc.) are using UTF-8 encoding. Therefore, opening our project in a windows environment will cause garbled code, and our APP will also be garbled. So you need to change the encoding method to UTF-8. The specific steps are as follows
Right-click the project (seller, ExpandTabView and so on), select the properties menu, In the first option Resource in the pop-up dialog box, for example, in Text file encoding, select UTF-8)
Note: My ubuntu system, the default is UTF-8, windows may want to choose a UTF-8 from the Other, specific self exploration, not difficult ).
So far, the encoding problem is solved. After the project are using UTF-8 for development. Common.
Part 2: Log System
1) Android. util. Log
Logs are composed of two parts. Some of them are Android. util. Log, which is default for Android. It can send logs to the logcat of DDMS for us to observe in real time. This is also the most important LOG method in our development. Quickly locate the problem.
2) Log4j.
Logcat logs are washed out. For some deep-level logic problems, rather than programming problems, Internet companies generally use the output logs to the file system and then send them to a log server. The log4j log output system is used for search. In Project/libs/, you can see that two jar libraries are log4j.
Log4J Initialization Configuration, in the file com. souya. seller. the setupLog4j () method in the sellerApplication file in the app package is configured. Check the code for details. The log system is configured when the APP is started.
Log4j does not play much role yet, but it is needed for a complete APP. It will be useful if it is complicated in the future. Observe dozens or even hundreds of megabytes of logs and locate complex problems that are not necessary.
For more information about log4j, see log4j.
Part 3: Package Structure
Shows the structure of the existing package.
Seller: contains several important activities. Do not place subsequent activities here.
App: Global class within the APP range.
Askbuy: user purchases
Askbuy. widget: UI component purchased by the user
Base: basic class of Fragment and Activity
Cache: Image cache System
ClothManager: Deployment Management
Data: data is mainly used for data processing with servers.
Database: Database-related, local SQLite.
Exception: exception Handling
Hotsearch: popular search
Misc: Constant
Module: module. It is mainly used by third-party libraries, other libraries, upgrade libraries, etc.
Search: search related functions, such as searching on ActionBar and automatic prompts.
Upload: Upload
Util: Tool
Widget: Common UI components.
Q &
1: Is the package reasonably structured?
A: It is unreasonable. Optimization will continue in the future, but this will be done for the time being. After all, refactoring is implemented based on a lot of code drivers.
2: why are so many packages?
A: the buyer and seller will be put together in the future. For functional pages such as clothmanager, a feature page is still designed with a package. Each package has no more than 10 files, and the logic is clear at a glance.