简体   繁体   English

是否可以使用MapView而无需扩展MapActivity?

[英]Is it possible to use a MapView without having to extend MapActivity?

Currently in my design I've got a base abstract class that all of my activities extend from, however I discovered recently that in order to use a MapView you need to make your activity extend MapActivity. 目前在我的设计中,我有一个基本的抽象类,我的所有活动都延伸到了,但是我最近发现,为了使用MapView,你需要让你的活动扩展MapActivity。 Since Java does not have multiple inheritance I was wondering if there is any way I can use a MapView without having to recreate my design for my application. 由于Java没有多重继承,我想知道是否有任何方法可以使用MapView而无需为我的应用程序重新创建我的设计。

Thanks in advance for any help! 在此先感谢您的帮助!

Regards, celestialorb. 此致,celestialorb。

Good question. 好问题。 I'm interested in what the others have to say. 我对其他人说的话很感兴趣。 If the answer is no, you should check out the OSMDroid project; 如果答案是否定的,你应该查看OSMDroid项目; that's the map I'm using for my application. 那是我用于我的应用程序的地图。 It's nice to have the source code to work with... 很高兴有源代码可以使用...

The answer is no. 答案是不。 It is not possible to utilize a MapView without extending MapActivity. 如果不扩展MapActivity,就无法使用MapView。 As gulbrandr pointed out there is a similar question here , this may be of use for anyone attempting the same thing that I was. 作为gulbrandr指出,有一个类似的问题在这里 ,这可能是使用的,任何人企图,我是同样的事情。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM