Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7671247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:00:23+00:00 2026-05-31T16:00:23+00:00

I get the errors below when touching the mapview. The ItemizedOverlay is shown correctly,

  • 0

I get the errors below when touching the mapview. The ItemizedOverlay is shown correctly, but I can not interact with it. Been searching online for solutions but can’t find any.

Logcat:

03-03 21:32:47.278: E/AndroidRuntime(18467): java.lang.NullPointerException
03-03 21:32:47.278: E/AndroidRuntime(18467):    at com.google.android.maps.ItemizedOverlay.getItemsAtLocation(ItemizedOverlay.java:617)
03-03 21:32:47.278: E/AndroidRuntime(18467):    at com.google.android.maps.ItemizedOverlay.getItemAtLocation(ItemizedOverlay.java:586)
03-03 21:32:47.278: E/AndroidRuntime(18467):    at com.google.android.maps.ItemizedOverlay.handleMotionEvent(ItemizedOverlay.java:498)
03-03 21:32:47.278: E/AndroidRuntime(18467):    at com.google.android.maps.ItemizedOverlay.onTouchEvent(ItemizedOverlay.java:572)
03-03 21:32:47.278: E/AndroidRuntime(18467):    at com.google.android.maps.OverlayBundle.onTouchEvent(OverlayBundle.java:63)
03-03 21:32:47.278: E/AndroidRuntime(18467):    at com.google.android.maps.MapView.onTouchEvent(MapView.java:643)
03-03 21:32:47.278: E/AndroidRuntime(18467):    at android.view.View.dispatchTouchEvent(View.java:3766)
03-03 21:32:47.278: E/AndroidRuntime(18467):    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:897)
03-03 21:32:47.278: E/AndroidRuntime(18467):    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
03-03 21:32:47.278: E/AndroidRuntime(18467):    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
03-03 21:32:47.278: E/AndroidRuntime(18467):    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
03-03 21:32:47.278: E/AndroidRuntime(18467):    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
03-03 21:32:47.278: E/AndroidRuntime(18467):    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
03-03 21:32:47.278: E/AndroidRuntime(18467):    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
03-03 21:32:47.278: E/AndroidRuntime(18467):    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
03-03 21:32:47.278: E/AndroidRuntime(18467):    at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1671)
03-03 21:32:47.278: E/AndroidRuntime(18467):    at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107)
03-03 21:32:47.278: E/AndroidRuntime(18467):    at android.app.Activity.dispatchTouchEvent(Activity.java:2086)
03-03 21:32:47.278: E/AndroidRuntime(18467):    at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1655)
03-03 21:32:47.278: E/AndroidRuntime(18467):    at android.view.ViewRoot.handleMessage(ViewRoot.java:1785)
03-03 21:32:47.278: E/AndroidRuntime(18467):    at android.os.Handler.dispatchMessage(Handler.java:99)
03-03 21:32:47.278: E/AndroidRuntime(18467):    at android.os.Looper.loop(Looper.java:123)
03-03 21:32:47.278: E/AndroidRuntime(18467):    at android.app.ActivityThread.main(ActivityThread.java:4627)
03-03 21:32:47.278: E/AndroidRuntime(18467):    at java.lang.reflect.Method.invokeNative(Native Method)
03-03 21:32:47.278: E/AndroidRuntime(18467):    at java.lang.reflect.Method.invoke(Method.java:521)
03-03 21:32:47.278: E/AndroidRuntime(18467):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-03 21:32:47.278: E/AndroidRuntime(18467):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
03-03 21:32:47.278: E/AndroidRuntime(18467):    at dalvik.system.NativeStart.main(Native Method)

Code that adds the itemizedoverlays:

// Add event markers
        List<Overlay> overlays = mapView.getOverlays();
        overlays.clear();
        CustomItemizedOverlay itemizedoverlayCurrent , itemizedoverlayCompleted, itemizedoverlayFuture;
        GeoPoint point;

        // Add events
        Cursor cursor = mDbHelper.fetchAllEvents();
        Drawable drawable = this.getResources().getDrawable(R.drawable.androidmarker);
        itemizedoverlayCurrent = new CustomItemizedOverlay(drawable, this);
        drawable = this.getResources().getDrawable(R.drawable.ic_launcher);
        itemizedoverlayCompleted = new CustomItemizedOverlay(drawable, this);
        drawable = this.getResources().getDrawable(R.drawable.androidmarker);
        itemizedoverlayFuture = new CustomItemizedOverlay(drawable, this);

        while(cursor.moveToNext()){
            Bundle b = new Bundle();
            b.putLong(EventDbAdapter.COLUMN_ID, cursor.getLong(cursor.getColumnIndex(EventDbAdapter.COLUMN_ID)));
            point = new GeoPoint(cursor.getInt(cursor.getColumnIndex(EventDbAdapter.COLUMN_EVENTS_START_LAT)), cursor.getInt(cursor.getColumnIndex(EventDbAdapter.COLUMN_EVENTS_START_LONG)));
            CustomOverlayItem overlayitem = new CustomOverlayItem(point, cursor.getString(cursor.getColumnIndex(EventDbAdapter.COLUMN_EVENTS_TITLE)), null, CustomOverlayItem.EVENT_TYPE, b);

            if(cursor.getInt(cursor.getColumnIndex(EventDbAdapter.COLUMN_EVENTS_TYPE)) == EventDbAdapter.EVENT_TYPE_COMPLETED) itemizedoverlayCompleted.addOverlay(overlayitem);
            else if(cursor.getInt(cursor.getColumnIndex(EventDbAdapter.COLUMN_EVENTS_TYPE)) == EventDbAdapter.EVENT_TYPE_CURRENT) itemizedoverlayCurrent.addOverlay(overlayitem);
            else if(cursor.getInt(cursor.getColumnIndex(EventDbAdapter.COLUMN_EVENTS_TYPE)) == EventDbAdapter.EVENT_TYPE_FUTURE) itemizedoverlayFuture.addOverlay(overlayitem);

        }
        overlays.add(itemizedoverlayCurrent);   
        overlays.add(itemizedoverlayCompleted); 
        overlays.add(itemizedoverlayFuture);    

        mapView.postInvalidate();

My itemizedoverlay class:

@SuppressWarnings("rawtypes")
public class CustomItemizedOverlay extends ItemizedOverlay {

    private ArrayList<CustomOverlayItem> mOverlays = new ArrayList<CustomOverlayItem>();
    private Context mContext;

    public CustomItemizedOverlay(Drawable defaultMarker) {super(boundCenterBottom(defaultMarker));}

    public CustomItemizedOverlay(Drawable defaultMarker, Context context) {
        super(boundCenterBottom(defaultMarker));
        mContext = context;
    }

    public void addOverlay(CustomOverlayItem overlay) {
        mOverlays.add(overlay);
        populate();
    }

    protected OverlayItem createItem(int i) {return mOverlays.get(i);}

    public int size() {return mOverlays.size();}

    protected boolean onTap(int index) {
        if(size() > 0){
            CustomOverlayItem i = mOverlays.get(index);
            Bundle b = i.getBundle();

            switch(i.getType()){
            case CustomOverlayItem.EVENT_TYPE:
                Toast.makeText(mContext, "EVENT", Toast.LENGTH_SHORT).show();
                break;
            case CustomOverlayItem.IMAGE_TYPE:
                break;
            case CustomOverlayItem.VIDEO_TYPE:
                break;
            case CustomOverlayItem.CONTACT_TYPE:
                break;
            case CustomOverlayItem.AUDIO_TYPE:
                break;  
            case CustomOverlayItem.UNKNOWN_TYPE:
                break;
            default:
                break;  
            }
        }
        return true;
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T16:00:24+00:00Added an answer on May 31, 2026 at 4:00 pm

    I’ve solved the problem. The error was arising when there was an itemizedoverlay, which had no overlayitems, on the mapview. The following code solved the error:

    if(itemizedoverlayCurrent.hasItems()) overlays.add(itemizedoverlayCurrent); 
    if(itemizedoverlayCompleted.hasItems())overlays.add(itemizedoverlayCompleted);  
    if(itemizedoverlayFuture.hasItems())overlays.add(itemizedoverlayFuture);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can't get the code below to compile (see errors). Advice on correction would
I can't seem to get the errors to go away. The errors are below.
I'm trying to call the SQL statement below but get the following error: System.Data.SqlClient.SqlException:
Can someone advise on why I get errors opening the file in the code
Can anyone see if there is something wrong with this? I get no errors
I know I can do this by str.c_str() , but I do not want
When I run below stored JavaScript function I get errors: > db.system.js.save({_id:last_n_users, value: function(n){return
When I try and compile this program, I get errors (included below the code)
I will get the error below randomly when I'm running an asp.net application I
I have a website that I get the below error on whenever I navigate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.