Getting this error when the populate() method is run in
ItemizedOverlay
09-03 18:44:16.869: WARN/System.err(3475):
java.lang.NullPointerException
09-03 18:44:16.869: WARN/System.err(3475): at
com.google.android.maps.ItemizedOverlay.populate(ItemizedOverlay.java:
312)
09-03 18:44:16.869: WARN/System.err(3475): at
test.Test.PointOverlay.addOverlay(PointOverlay.java:49)
09-03 18:44:16.869: WARN/System.err(3475): at
test.Test.Map.onCreate(Map.java:91)
09-03 18:44:16.877: WARN/System.err(3475): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
1047)
09-03 18:44:16.877: WARN/System.err(3475): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2627)
09-03 18:44:16.877: WARN/System.err(3475): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2679)
09-03 18:44:16.877: WARN/System.err(3475): at
android.app.ActivityThread.access$2300(ActivityThread.java:125)
09-03 18:44:16.877: WARN/System.err(3475): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
09-03 18:44:16.877: WARN/System.err(3475): at
android.os.Handler.dispatchMessage(Handler.java:99)
09-03 18:44:16.877: WARN/System.err(3475): at
android.os.Looper.loop(Looper.java:123)
09-03 18:44:16.877: WARN/System.err(3475): at
android.app.ActivityThread.main(ActivityThread.java:4627)
09-03 18:44:16.877: WARN/System.err(3475): at
java.lang.reflect.Method.invokeNative(Native Method)
09-03 18:44:16.877: WARN/System.err(3475): at
java.lang.reflect.Method.invoke(Method.java:521)
09-03 18:44:16.877: WARN/System.err(3475): at
com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:868)
09-03 18:44:16.877: WARN/System.err(3475): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
09-03 18:44:16.885: WARN/System.err(3475): at
dalvik.system.NativeStart.main(Native Method)
The process running up to this error is as follows: Map, an Activity,
creates and adds two overlays to its map view inside its onCreate
method. When I first run the application, this works fine. My two
overlays appear on the map as expected. I hit the back button (takes
me to a different activity in the application), and re-enter the map
activity. It works fine again. I go back, return, and then
consistently (tried this at least five times now) crashes on my third
return trip to the map. A few PointOverlay methods are as follows:
public void addOverlay(OverlayItem overlay)
{
mOverlays.add(overlay);
populate();
}
@Override
protected OverlayItem createItem(int i)
{
return mOverlays.get(i);
}
@Override
public int size()
{
return mOverlays.size();
}
mOverlays is an ArrayList of OverlayItem objects.
PointOverlay extends ItemizedOverlay.
If anyone has any theories and needs more info, let me know what you
need to know.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en