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.base
Is 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With