-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Organizing your Source Files
Android applications should always be neatly organized with a clear folder structure that makes your code easy to read. The way to do this is to logically group related things together into sub-packages within your application. Make sure every app has the following subpackages:
-
com.example.myapp.activities
- Contains all activities -
com.example.myapp.adapters
- Contains all custom adapters -
com.example.myapp.models
- Contains all our data models -
com.example.myapp.fragments
- Contains all fragments -
com.example.myapp.helpers
- Contains all helpers (custom code that supports the app). -
com.example.myapp.interfaces
- Contains all interfaces
Keeping these folders in each app means that code is logically organized and scanning the code is a pleasant experience.
Created by CodePath with much help from the community. Contributed content licensed under cc-wiki with attribution required. You are free to remix and reuse, as long as you attribute and use a similar license.
Finding these guides helpful?
We need help from the broader community to improve these guides, add new topics and keep the topics up-to-date. See our contribution guidelines here and our topic issues list for great ways to help out.
Check these same guides through our standalone viewer for a better browsing experience and an improved search. Follow us on twitter @codepath for access to more useful Android development resources.