-1

in android application I am using the Google API for maps. I got the following exception. I want to know what exactly this exception means ?

10-19 23:45:06.619: E/AndroidRuntime(837): FATAL EXCEPTION: main
10-19 23:45:06.619: E/AndroidRuntime(837): java.lang.NullPointerException
10-19 23:45:06.619: E/AndroidRuntime(837):  at com.google.android.maps.ItemizedOverlay.getItemsAtLocation(ItemizedOverlay.java:617)
10-19 23:45:06.619: E/AndroidRuntime(837):  at com.google.android.maps.ItemizedOverlay.getItemAtLocation(ItemizedOverlay.java:586)
10-19 23:45:06.619: E/AndroidRuntime(837):  at com.google.android.maps.ItemizedOverlay.handleMotionEvent(ItemizedOverlay.java:498)
10-19 23:45:06.619: E/AndroidRuntime(837):  at com.google.android.maps.ItemizedOverlay.onTouchEvent(ItemizedOverlay.java:572)
10-19 23:45:06.619: E/AndroidRuntime(837):  at com.google.android.maps.OverlayBundle.onTouchEvent(OverlayBundle.java:63)
10-19 23:45:06.619: E/AndroidRuntime(837):  at com.google.android.maps.MapView.onTouchEvent(MapView.java:679)
10-19 23:45:06.619: E/AndroidRuntime(837):  at android.view.View.dispatchTouchEvent(View.java:3885)
10-19 23:45:06.619: E/AndroidRuntime(837):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:903)
10-19 23:45:06.619: E/AndroidRuntime(837):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:869)
10-19 23:45:06.619: E/AndroidRuntime(837):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:869)
10-19 23:45:06.619: E/AndroidRuntime(837):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:869)
10-19 23:45:06.619: E/AndroidRuntime(837):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:869)
10-19 23:45:06.619: E/AndroidRuntime(837):  at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1691)
10-19 23:45:06.619: E/AndroidRuntime(837):  at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1125)
10-19 23:45:06.619: E/AndroidRuntime(837):  at android.app.Activity.dispatchTouchEvent(Activity.java:2096)
10-19 23:45:06.619: E/AndroidRuntime(837):  at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1675)
10-19 23:45:06.619: E/AndroidRuntime(837):  at android.view.ViewRoot.deliverPointerEvent(ViewRoot.java:2194)
10-19 23:45:06.619: E/AndroidRuntime(837):  at android.view.ViewRoot.handleMessage(ViewRoot.java:1878)
10-19 23:45:06.619: E/AndroidRuntime(837):  at android.os.Handler.dispatchMessage(Handler.java:99)
10-19 23:45:06.619: E/AndroidRuntime(837):  at android.os.Looper.loop(Looper.java:130)
10-19 23:45:06.619: E/AndroidRuntime(837):  at android.app.ActivityThread.main(ActivityThread.java:3683)
10-19 23:45:06.619: E/AndroidRuntime(837):  at java.lang.reflect.Method.invokeNative(Native Method)
10-19 23:45:06.619: E/AndroidRuntime(837):  at java.lang.reflect.Method.invoke(Method.java:507)
10-19 23:45:06.619: E/AndroidRuntime(837):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
10-19 23:45:06.619: E/AndroidRuntime(837):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
10-19 23:45:06.619: E/AndroidRuntime(837):  at dalvik.system.NativeStart.main(Native Method)
Adham
  • 63,550
  • 98
  • 229
  • 344
  • please, add more information. Paste snippets of code here. You got `NullPointerException` on Touch MapView – Maxim Shoustin Oct 20 '12 at 00:01
  • Please add your code so we can help you to find out your `NullPointException`. Its logically impossible to look like this. Well, still on, it might be because of 2 reasons. 1). You didn't made object instance for `ItemizedOverlay`, else something missing in your method `onTouchEvent`. – Hamza Waqas Oct 20 '12 at 00:04
  • We can't tell from this. Something is trying to be used before it is instantiated(it's null). If you post more code where the error is coming from we may be able to help. Also, if you put a breakpoint around the place where it is happening then you can narrow down the variable/class that is giving you the null pointer exception. Depending on what it is, you may be able to add a condition to make sure it isn't null before proceeding with the code – codeMagic Oct 20 '12 at 00:05
  • Please, Add your code hare for more information. – Gaurav Pansheriya Sep 27 '13 at 07:14

1 Answers1

1

The sound like you forgot to add populate() in the constructor.

It should be like:

LocationItemizedOverlay(Drawable defaultMarker, Context context) {
    super(boundCenterBottom(defaultMarker));
    this.context = context;
    populate(); // Add this
}
.....

Its happens on moving map

Maxim Shoustin
  • 77,483
  • 27
  • 203
  • 225