Reputation: 7114
I am new to Java and to Android development. In all the tutorials at my current level of understanding, the only user-created classes are found in the directory app/src/main/java/com.example.project/
, and all these classes refer to views.
In my project, I will need to write a number of classes which are not directly related to any particular views. For example, a TextToSpeech class and a PatternRecognition class.
What are considered to be the best practices for managing the class files in the directory hierarchy? What online resources can you recommend, so that I can explore this question in more detail?
Upvotes: 2
Views: 763
Reputation: 5673
I suggest to read this article http://fernandocejas.com/2014/09/03/architecting-android-the-clean-way/.
And take a look on this repository https://github.com/android10/Android-CleanArchitecture.
Upvotes: 3
Reputation: 1918
I'm not sure, that this is the best way, but my Android projects looks like this:
src
├───androidTest
│ └───java
│ └───hu
│ └───company
│ └───app
│ └───activities
│ ├───login
│ └───main
└───main
├───assets
│ └...
├───java
│ └───hu
│ └───company
│ └───app
│ ├───activities
│ │ ├───login
│ │ ├───main
│ │ ├───mainMenu
│ │ └───surveys
│ ├───common
│ └───communication
└───res
└──...
And in the hu.company.app
package, I have more packages. All of my Activities in the activities
package, sorted by their functionality. And I have other classes in upper packages.
When I started this project, I could'nt find any docs about the "best" Android project structure. I'm not sure, that this is a right project structure, but it works.
Upvotes: 1