Multiple map views?

2020-07-31 05:39发布

I have an application that has two map views one satellite and one street view. They both keep showing up as a satellite view even though one is set to setStreetView(true); and the other is set to setSattelite(true);. How would I get it so that both views show different maps?

Thanks in advance.

2条回答
我只想做你的唯一
2楼-- · 2020-07-31 06:22

Assuming you are talking about showing both at the same time, it doesn't appear to be possible. See How to Make 2 MapView on One Activity

Updated to respond to comment.

Per the Google Map API MapActivity, "Only one MapActivity is supported per process. Multiple MapActivities running simultaneously are likely to interfere in unexpected and undesired ways." So even if you have two different MapActivities you have to deal with the Process Lifecycle, where perhaps one activity is visible and the other activity is background and that is where you are getting problems.

2nd Update

So according to this thread Limitations of the MapView and MapActivity one commenter put a separate activity between two MapActivities and was able to make it work, but otherwise you will have to use overlays/find a way to make your app work with only one MapActivity.

查看更多
【Aperson】
3楼-- · 2020-07-31 06:38

A solution is proposed here.

It's known that you might experience some issues when using multiple mapviews in one process. Usually this is the case (your app running in one process) if you don't configure anything specific. You could though use the android:process attribute in your manifest to assign to your activites

查看更多
登录 后发表回答