Android Studio和QUOT;移动"和"穿"项目模块,共享组件的位置 [英] Android Studio "mobile" and "wear" project modules, shared components location
问题描述
在我的Android Studio项目中有两个机器人模块的移动和穿,这似乎是类型的Android设备将能够运行此应用程序的视图和控制器
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
我希望他们分享一些逻辑,如模型文件和POJO那么,应该是储存在哪里?我想到了移动模块做了很多繁重比穿的模块,但我应该把模型对象在该模块中,或者我应该做一个新的第三个模块,它们可以同时使用? (或一些其它设计范例)
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)
推荐答案
看看有: 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.
在哪里把你的对象......如果你希望使用上佩戴移动相同的对象,将它们放在通用
的项目,所以,它们会自动这两个之间共享(无code复制),但如果特定对象只使用移动并且在未来不需要增加他的服装,只是把他的移动项目。
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.
这篇关于Android Studio和QUOT;移动"和"穿"项目模块,共享组件的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!