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

  • SEARCH
  • Home
  • 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 8512737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:21:52+00:00 2026-06-11T04:21:52+00:00

There is already an overlay, drawing something on a map view. I want to

  • 0

There is already an overlay, drawing something on a map view. I want to add another overlay and a customized item to the map view. Nothing shows. What’s wrong with my code? Thanks heaps.

My sub-class of ItemizedOverlay

public class PinItemizedOverlay extends ItemizedOverlay {
private static int MAX_PIN = 3;
private OverlayItem overlays[] = new OverlayItem[MAX_PIN];

private int index = 0;
private boolean full = false;
private Context context;

public PinItemizedOverlay(Context context, Drawable defaultMarker) {
    //super(boundCenterBottom(defaultMarker));
    super(boundCenterBottom(defaultMarker));
    this.context = context;
}

@Override
public OverlayItem createItem(int index) {
    return overlays[index];
}

public int size(){
    if (full) {
        return overlays.length;
    } else {
        return index;
    }
}

public void addOverlay(OverlayItem overlay) {
    if (index <     MAX_PIN) {
        overlays[index] = overlay;
    } else {
        return;
    }
    index++;
    populate();
}
}

My customized overlay item

 public class LocationPinItem extends OverlayItem{

    public LocationEntity location;

    public LocationPinItem(GeoPoint point, int iconRes, LocationEntity location){
        //super(point,null,null);
        super(point, null, null);
        Drawable marker = getApplicationContext().getResources().getDrawable(iconRes);
        super.setMarker(marker );
        this.location = location;

    }

}

And the function where I add the customized item (it’s a drop pin):

private void createMarkerAt(LocationEntity location, String extra, int iconRes, boolean clear, boolean animate) {
    if(location == null) {
        return;
    }
    GeoPoint point = new GeoPoint((int) (location.latitude * 1E6), (int) (location.longitude * 1E6));

    LocationPinItem pinItem = new LocationPinItem(point,R.drawable.ic_swap,location);
    PinItemizedOverlay pinOverlay = new PinItemizedOverlay(getApplicationContext(),mMapDrawable) ;
    pinOverlay.addOverlay(pinItem);


mMapView.removeAllViews();
mMapView.postInvalidate();

    mMapView.getOverlays().add(pinOverlay);

    if(animate) {
        mMapView.getController().animateTo(location.toGeoPoint());
    }


}
  • 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-06-11T04:21:53+00:00Added an answer on June 11, 2026 at 4:21 am

    never mind, I figured it out: the newly-added overlay occludes the previous overlay

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to know if an overlay already exist on a map,
There's already a question on this here. But i want to know if its
Is there an already-existing piece of commercial or academic software that can overlay results
I m trying to add an item to the DOM using jquery. I want
Is there already a handy CI 2 library for AWS SDK 1.5.x? If not,
There are already several questions with a similar title, but they received either no
There are already lots of questions on SO about exceptions, but I can't find
There are already a couple of questions on finding cycles, but I did not
There are already jQuery based Edit in place plug ins available. But i am
There is already a similar question( link ).The thing is I don't understand what

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.