0

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 page 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.?

CharlesB
  • 86,532
  • 28
  • 194
  • 218
ecah
  • 1

1 Answers1

0

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.

Flo
  • 27,355
  • 15
  • 87
  • 125
  • if i click the back button on android device it doesn't go back to the main page..the application close immediately.. – ecah Apr 11 '11 at 06:13
  • Do you call finish on you main activity before you switch to the map activity? – Flo Apr 11 '11 at 07:27
  • i only has one class which is MapsActivity and all the functions goes there included another mapviews,function to call from the selected list page..so, where did i must put the function finish().? – ecah Apr 12 '11 at 15:37