Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Package Structure Best Practice [closed]

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?

like image 616
Carl G Avatar asked Jul 07 '11 20:07

Carl G


1 Answers

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

like image 108
Phil Avatar answered Oct 13 '22 21:10

Phil