Android Package Structure Best Practice [closed]
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question 开发者_如何学运维I have a question regarding best practices for application package structure.
I watched Reto Meier's Google I/O 2011 presentation "Android Protips: Advanced Topics for Expert Android Developers" and read his blog post "A Deep Dive Into Location" and noted his application package structure of:
com. ... .content_providers
com. ... .receivers com. ... .services com. ... .UI com. ... .UI.fragments com. ... .utils com. ... .utils.baseIs this the preferred structure for packages? Is there a better structure?
The main goal of packaging your classes is to simplify the navigation through your source code. This is especially important for open source applications. In my opinion, a easy-to-navigate package structure includes the following packages:
com.example.main
- contains your main driver functions, such as your main activity(s), your application class (if you have one), etc
com.example.conf
- contains your configuration files, such as those containing constants (static final variables)
com.example.net
- network-related classes, such as those that make http requests
com.example.util
- utility classes, such as services, BroadcastReceivers, or other background processes
精彩评论