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 8379771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:16:51+00:00 2026-06-09T16:16:51+00:00

The onTap() method working when there is minimum one point on map but when

  • 0

The onTap() method working when there is minimum one point on map but when I remove all points from map then onTap() method is not working and I am unable to add points on map.

Please help…

Code:

    private class CustomItemizedOverlay2 extends ItemizedOverlay<OverlayItem> {

    private ArrayList<OverlayItem> mapOverlays = new ArrayList<OverlayItem>();
    private Context context;
    private GeoPoint center = null;

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

    public CustomItemizedOverlay2(Drawable defaultMarker, GeoPoint point) {
        this(defaultMarker);
        OverlayItem overlayItem = new OverlayItem(point, "", "");
        mapOverlays.add(overlayItem);
        populate();
    }

    public CustomItemizedOverlay2(Drawable defaultMarker, Context context,
            String result) {
        this(defaultMarker);
        this.context = context;

        for (int i = 0; i < geoPointList.size(); i++) {
            OverlayItem overlayItem = new OverlayItem(geoPointList.get(i),
                    "abc", "point" + i);
            mapOverlays.add(overlayItem);
        }
        populate();
    }

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

    @Override
    public int size() {
        return mapOverlays.size();
    }

    @Override
    public boolean onTap(GeoPoint point, MapView mapView) {

        int size = geoPointList.size();
        if (size < 2) {
            geoPointList.add(point);

            count++;
            int lat = point.getLatitudeE6();
            int longi = point.getLongitudeE6();
            Drawable image = gMap.this.getResources().getDrawable(
                    R.drawable.pushpin);

            CustomItemizedOverlay2 addPointItemizedOverlay = new CustomItemizedOverlay2(
                    image, point);
            mapView.getOverlays().add(addPointItemizedOverlay);


            mapView.invalidate();
        }
        return super.onTap(point, mapView);
    }



}

The onTap method add point if the number of points in geoPointList is less than two.

  • 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-09T16:16:53+00:00Added an answer on June 9, 2026 at 4:16 pm

    Finally solved, as I have implemented the custom MapOverlay and use the onTap method in it instead of using in CustomItemizedOverlay2.

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

Sidebar

Related Questions

Is it possible to pass the touch event from Ovelay onTap method to the
I am trying to place a marker on a map overlay and then present
I have an activity which extends MapActivity. But when I tap the map, the
I followed the instructions from the google hellomapview tutorial. I get a working mapview
I would like to have a Spinner updated upon an onTap event in my
I've implemented a Class that extends Overlay and also override the onTap / onTouchEvent
I basically have an image of a world map and i would like to
I just cant get this working. I tried using the code below with onTouchEventand
I using class Overlay to marker place on map.. I want show infomation of
Hello i am unable to fire ontap() event i want to add a marker

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.