I have a class which extends OverlayItem to include more fields. I have changed all the OverlayItem occurrences in my program with a PointOfInterest class.
When I try to run the same program which worked for OverlayItem, it crashes with a nullpointerException after calling populate() in my ItemizedOverlay class. The Log prints out the correct value. Here is the method it crashes in.
protected void addOverlay(PointOfInterest pointOfInterest) {
mapOverlays.add(pointOfInterest);
setLastFocusedIndex(-1);
Log.d("Add Overlay", pointOfInterest.getDescription());
populate(); <-- Crashes here
}
And the error
12-06 17:29:03.610: E/AndroidRuntime(1822): java.lang.NullPointerException
12-06 17:29:03.610: E/AndroidRuntime(1822): at com.google.android.maps.ItemizedOverlay.populate(ItemizedOverlay.java:312)
12-06 17:29:03.610: E/AndroidRuntime(1822): at com.example.mapproject.OurItemizedOverlay.addOverlay(OurItemizedOverlay.java:108)
12-06 17:29:03.610: E/AndroidRuntime(1822): at com.example.mapproject.MainActivity.addPointToMap(MainActivity.java:211)
Any ideas? Thanks !