I have a simple overlay for Google Maps: http://pastebin.com/Rg8miMSh , and I add / remove elements on it depending on the zoom level. After deleting / adding, I cause padding on the overlay and is invalid on the map. Everything works fine, except for 1 failure: after deleting an element, if I touch its location, it still starts and because OverlayItem is no longer there, I get java.lang.ArrayIndexOutOfBoundsException in com.google.android.maps.ItemizedOverlay. maskHelper (ItemizedOverlay.java∗62) (full stack trace - http://pastebin.com/KThn4ZLE )
Does anyone know why this is happening? Initially, I called it clear and added all the elements again, which did not seem to cause this problem. However, with many things, this became a performance issue. Adding / removing only the difference works much faster, and I would like to keep this method. Thank!
source
share