How to organize your Android code structure
Doing things right, and keeping classes single-purpose, will end you up with a lot of files in Android projects. So, organizing your code structure is a popular topic in the community. Also because it's something specific to your projects.
Here are some suggestions:
- Android Best Practices: Java packages architecture
- Organizing Your Android Development Code Structure
It's generally a personal preference, as long as it's clear.
Here's what I'm using in my current project:
- Google Analytics, Facebook Analytics...
- API Services (for Retrofit)
- API Response/Request models (for GSON parsing)
- Bus Provider and Event classes (for Otto)
- Simple and re-usable general helper classes (Preconditions, PreferencesHelpers...)
- Domain related models. These are different from the api.models when the API is from a external source you don't control.
- Domain specific services, tightly related with your application business logic (Could also be managers)
- Android activities
- For ListViews and RecyclerViews
- Custom views
- Application class