MapView without MapActivity

后端 未结 2 978
眼角桃花
眼角桃花 2020-12-18 08:22

I am writing this android application where in I have many activities that extend the Activity class. I also need an activity that uses MapView to show the Map along with a

2条回答
  •  有刺的猬
    2020-12-18 09:08

    I don't think there is any way around this. A MapView will only work in a MapActivity and each MapActivity can only contain 1 MapView. I have run into similar problems when using a single Activity base class. Try moving some of the code from your base class into either static methods or into a composite design pattern to cut down on the amount of copied code. It should be possible to design your code so that only the onX methods need to be duplicated between your base Activity and your MapActivty.

提交回复
热议问题