[英]Using Amazon Maps beside Google Maps in the same app
As the title says I'm already using Google Maps in my app and I also would like to use Amazon Maps in case of Kindle devices. 如标题所示,我已经在我的应用程序中使用Google Maps,并且我也想在Kindle设备的情况下使用Amazon Maps。 AM and GM v1 uses the same interface technically.
AM和GM v1在技术上使用相同的接口。 How can i solve it nicely that depending on the device I'm using I get the appropriate class type (eg com.google.android.maps.MapView or com.amazon.geo.maps.MapView) for every class?
我如何才能很好地解决这个问题,即根据我使用的设备,为每个类获取合适的类类型(例如com.google.android.maps.MapView或com.amazon.geo.maps.MapView)?
So let's say I need the appropriate version of the MapView class depending on my device because I want to construct a MapView object. 假设我需要根据设备使用适当版本的MapView类,因为我想构造一个MapView对象。 As I said AM and GM has the same classes and methods but they don't implement a common interface though which prevents me from using a factory I think.
正如我所说的,AM和GM具有相同的类和方法,但是它们没有实现公共接口,尽管这使我无法使用我认为的工厂。
edit: 编辑:
I hope I don't have to if(gmaps) { do something with gmaps objects } else if (amaps) { do the same with amaps objects } 我希望我不必if(gmaps){对gmaps对象做某事}否则if(amaps){对amaps对象做同样的事}
As I said the problem I think is that the two API has the same classes, methods and everything but they don't actually implement a common interface which makes it hard for me do think up a nice solution. 正如我所说的那样,我认为问题在于两个API具有相同的类,方法和所有内容,但它们实际上并未实现一个公共接口,这使我很难想出一个不错的解决方案。 What do you think?
你怎么看?
Thanks in advance! 提前致谢!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.