I immediately want to point out that I know such methods as setVisible () and remove (), but I do not know how to use them in this particular case. Well, in my application I add markers on the map in different places, which are numbered .titles and would like to make a button that will remove the last added marker.
Each successive marker in my application has a feature .title (String.valueOf (f)), where f is the numbers that represent another marker from 0.
I might add that the markers are assigned to each collected location saved in the ArrayList.
How will look button, which when pressed will remove the last marker from the map? Only last.
hold pointers to them then you will be able to remove them, here is sample:
// Somewhere above: private Marker mMyLocationMarker; // Add marker with options mMyLocationMarker = mGoogleMap.addMarker(options); // And to remove: mMyLocationMarker.remove();
need more markers? - hold pointers in