Saturday, September 15, 2012
Yesterday when I was working in Android, I got a strange exception. I am adding an ItemizedOverlay to google map. I am adding OverlayItem to the ItemizedOverlay when one condition is true. But sometimes, this condition is false and not adding any OverlayItem to the ItemizedOverlay. But still adding the ItemizedOverlay to google maps. At this time, I am getting null pointer exception. First I didn't get what is going wrong. Then after some googling, I came to know we can't add ItemizedOverlay to google map when there is no OverlayItem in the Overlay. So be careful when adding empty ItemizedOverlay to google maps. I was working in API level 10. I am not sure whether this problem is in future versions.