NullPointer Exception with adding new Overlay to MapView
<p>There is the following code for ItemizedOverlay:</p>

<pre><code>private class AppointmentsOverlay extends ItemizedOverlay {
    private List&lt;OverlayItem&gt; locations;

    public AppointmentsOverlay(Drawable defaultMarker, List&lt;Address&gt; addresses) {
        super(defaultMarker);
        locations=new ArrayList&lt;OverlayItem&gt;();
        convertAddressesToOverlayItems(addresses);
    }

    private void convertAddressesToOverlayItems(List&lt;Address&gt; addresses) {
        for (Address address:addresses) {
            GeoPoint gp=new GeoPoint((int)(address.getLatitude()*1000000), 
                (int)(address.getLongitude()*1000000));
            locations.add(new OverlayItem(gp, "1", "1"));
        }
    }

    @Override
    protected OverlayItem createItem(int i) {
        return locations.get(i);
    }

    @Override
    public int size() {
        return locations.size();
    }   
}
</code></pre>

<p>and following code for adding this overlay to MapView:</p>

<pre><code>private void initializeMapWithAppointments(List&lt;Address&gt; addresses) {
    Drawable marker=getResources().getDrawable(R.drawable.marker);
    mMapViewAppointments.getOverlays().add(new AppointmentsOverlay(marker, addresses));
    //mMapViewAppointments.setClickable(false);
}
</code></pre>

<p>if I click by MapView I got the following exception message:</p>

<pre><code>04-09 19:57:36.948: E/MapActivity(7053): Couldn't get connection factory client
04-09 19:57:41.263: E/AndroidRuntime(7053): FATAL EXCEPTION: main
04-09 19:57:41.263: E/AndroidRuntime(7053): java.lang.NullPointerException
04-09 19:57:41.263: E/AndroidRuntime(7053):     at com.google.android.maps.ItemizedOverlay.getItemsAtLocation(ItemizedOverlay.java:617)
04-09 19:57:41.263: E/AndroidRuntime(7053):     at com.google.android.maps.ItemizedOverlay.getItemAtLocation(ItemizedOverlay.java:586)
04-09 19:57:41.263: E/AndroidRuntime(7053):     at com.google.android.maps.ItemizedOverlay.handleMotionEvent(ItemizedOverlay.java:498)
04-09 19:57:41.263: E/AndroidRuntime(7053):     at com.google.android.maps.ItemizedOverlay.onTouchEvent(ItemizedOverlay.java:572)
04-09 19:57:41.263: E/AndroidRuntime(7053):     at com.google.android.maps.OverlayBundle.onTouchEvent(OverlayBundle.java:63)
04-09 19:57:41.263: E/AndroidRuntime(7053):     at com.google.android.maps.MapView.onTouchEvent(MapView.java:679)
04-09 19:57:41.263: E/AndroidRuntime(7053):     at android.view.View.dispatchTouchEvent(View.java:5579)
04-09 19:57:41.263: E/AndroidRuntime(7053):     at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1959)
04-09 19:57:41.263: E/AndroidRuntime(7053):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1720)
04-09 19:57:41.263: E/AndroidRuntime(7053):     at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1965)
04-09 19:57:41.263: E/AndroidRuntime(7053):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1692)
04-09 19:57:41.263: E/AndroidRuntime(7053):     at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1965)
04-09 19:57:41.263: E/AndroidRuntime(7053):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1692)
04-09 19:57:41.263: E/AndroidRuntime(7053):     at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1965)
04-09 19:57:41.263: E/AndroidRuntime(7053):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1692)
04-09 19:57:41.263: E/AndroidRuntime(7053):     at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1965)
04-09 19:57:41.263: E/AndroidRuntime(7053):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1692)
04-09 19:57:41.263: E/AndroidRuntime(7053):     at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1983)
04-09 19:57:41.263: E/AndroidRuntime(7053):     at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1442)
04-09 19:57:41.263: E/AndroidRuntime(7053):     at android.app.Activity.dispatchTouchEvent(Activity.java:2421)
04-09 19:57:41.263: E/AndroidRuntime(7053):     at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1931)
04-09 19:57:41.263: E/AndroidRuntime(7053):     at android.view.View.dispatchPointerEvent(View.java:5759)
04-09 19:57:41.263: E/AndroidRuntime(7053):     at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:2970)
04-09 19:57:41.263: E/AndroidRuntime(7053):     at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2529)
04-09 19:57:41.263: E/AndroidRuntime(7053):     at android.view.ViewRootImpl.processInputEvents(ViewRootImpl.java:869)
04-09 19:57:41.263: E/AndroidRuntime(7053):     at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2538)
04-09 19:57:41.263: E/AndroidRuntime(7053):     at android.os.Handler.dispatchMessage(Handler.java:99)
04-09 19:57:41.263: E/AndroidRuntime(7053):     at android.os.Looper.loop(Looper.java:154)
04-09 19:57:41.263: E/AndroidRuntime(7053):     at android.app.ActivityThread.main(ActivityThread.java:4945)
04-09 19:57:41.263: E/AndroidRuntime(7053):     at java.lang.reflect.Method.invokeNative(Native Method)
04-09 19:57:41.263: E/AndroidRuntime(7053):     at java.lang.reflect.Method.invoke(Method.java:511)
04-09 19:57:41.263: E/AndroidRuntime(7053):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
04-09 19:57:41.263: E/AndroidRuntime(7053):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
04-09 19:57:41.263: E/AndroidRuntime(7053):     at dalvik.system.NativeStart.main(Native Method)
</code></pre>

<p>I don't understand what it means, because I can't see my new custom ItemizedOverlay too. I've added api key and I see empty MapView. Please, tell me, how can I fix it? Thanks. </p>
