使用多个的传承活动多个

2023-09-12 06:03:37 作者:终究过了期

有没有办法继承的android两个不同的活动。我必须要显示的一些其他活动继承在地图上我的活动。我想,以显示该活动的地图,但没有继承MapActivity我不能显示地图。有以显示地图,而无需使用MapActivity任何其他方式。

Is there way to inherit two different activities in android. I have to display the Map on my activity which inherit from some other activity. i want to display a map on that activity but i can't display the map without inheriting MapActivity. Is there any other way to display the map without using MapActivity.

推荐答案

没有,Android是基于java的。和Java不支持多重继承。 Java支持多种接口。

No, android is java based. And java do not support multiple inheritance. Java supports multiple interfaces.

也许使用的碎片会有所帮助。片段可以模拟多种活动。然而,所有的活动必须是可用的片段。我不知道是否存在一个用于地图

Maybe using fragments will help. Fragments could simulate multiple activities. However, all "activities" must be available as fragment. I am not sure whether there exist one for maps