开发者

Maps Activity single mapview

I have a map views which is have some markers on the map and a back button to the main page. I also have a list of textview which is when selected, it will open a new p开发者_如何学Cage that have a button "View Map". The button "view map" will open up a map. Each selected page has different map view which is different markers on it.

The problem is :

It works fine when I select the list of textview and "view map" button. The button back also functioning well. However, when i select another list and click the button view map, debug force close appear. I look for the solutions and the DDMS shows that "you are only allowed to have a single mapview in a mapactivity". How i'm going to fix this problem with the simpler ways without create another class or create new activity in android manifest.?


Refactor your map activity in a way so you can pass a bunch of data to it which will contain the information about the locations to be displayed. By doing this you can mark different sets of places on you map dynamically. For this you can either use on Overlay class in you map activity or for each set of markers an own Overlay class.

This should made it possible to use one MapView multiple times.

Another thing you should avoid is displaying a back button. Normally you don't need one as every Android device has a back button by design. So another back button might confuse your users.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜