问题
In my Android Studio project there are two android modules "mobile" and "wear", these seem to be the views and controllers for the types of android devices that will be able to run this application
I expect them to share some logic, such as the model files and POJOs so where should that be stored? I expect the "mobile" module to do a lot more heavy lifting than the "wear" module, but should I put the model objects in that module, or should I make a new third module that they can both use? (or some other design paradigm)
回答1:
Take a look there: https://github.com/tajchert/SWear_Weather
I created common
module that (in my case) have constant variables, and is shared between phone and Wear module.
About where to put your objects... if you expect to use same objects on Wear an mobile, put them in common
project so they are automatically shared between those two (no code duplication), but if particular object is used only on mobile and there is no need in future to add him on Wear, just put him in mobile project.
Also common
project can allow you to share stuff like assets (icons etc.) between mobile and Wear device.
来源:https://stackoverflow.com/questions/25505629/android-studio-mobile-and-wear-project-modules-shared-components-location