Google Maps API v2 multiple map fragment problems

回眸只為那壹抹淺笑 提交于 2019-12-06 16:02:41

Nobody answer so I finally succed on my own.

So I will share for the others with the same problem. It seams that there is a bug, that if you have several fragments and you try to instanciate two or more maps (Google Maps) seams to take the same instance previously saved, even that you use SupportMapFragment.newInstance()

Anyway, what you should do is always close the map before open a new one, so if you want to show the second map, first of all remove the fragment with the previous map. And then instantiate a new on and add to the correspondent layout.

It's not a really good solution because it means to open and close the maps everytime, but is the best I could find.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!