I'm building my first android app, and it's gotten a little messy already. I'm using List/detail patterns because they're what fit the circumstances, but because I'm developing for both mobile and tablet it's getting a bit out of hand. For every screen (List/detail being one screen), four files are created. ListActivity, ListFragment, DetailActivity, DetailFragment. Having four screens so far, and literally just starting the project, I have 12 files, plus three helper files for one database table.
What I'm asking, is what's the best way to organize this? I'm using Android Studio, and it seems I can't sort the files into folders without putting them in separate packages. So do I do something like com.domain.app.screen1.(Fragments|Activities), com.domain.app.screen2.(Fragments|Activities) and so on? Or do I just put up with it? Or is there a better way of doing this?
If I'm being unclear, just let me know and I'll try to clear it up
Good Explain by @Eric Oestrich:
Writing a medium to large Android app requires having code structure. In creating our latest Android development project, I came across a structure that has helped me out.
Java Code :
com.example
activities
Contains all the activities. Classes are all named with Activity at the end. That way, you can immediately know what it is when reading Java code that doesn't have its full package name.
adapters
Contains all the adapters.
Contains any class related to signing a user in. I create a local account and having all related classes together is very handy.
Contains all classes related to data management such as ContentProvider and SQLiteHelper.
Contains all of my SQLite migrations.
Contains all fragments.
Contains helper classes. A helper class is a place to put code that is used in more than one place. I have a DateHelper for instance. Most of the methods are static.
Contains all interfaces.
Contains all local models. When syncing from an HTTP API I parse the JSON into these Java objects using Jackson. I also pull Cursor rows into these models as well.
Contains all classes for custom preferences. When creating the preferences I required a custom PreferenceDialog as well as a custom PreferenceCategory. They live here.
Contains all classes related to syncing. I use a SyncAdapter to pull data from an HTTP API. In addition to the SyncAdapter a SyncService is required, so I created a package.
Layouts :