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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:04:00+00:00 2026-06-07T13:04:00+00:00

I have implemented google maps in my application. I have written my own overlay

  • 0

I have implemented google maps in my application. I have written my own overlay class extending ItemizedOverlay to add overlays. Using the same overlay class, I also add an overlay to show my current location on the map.

The onTouchEvent of this overlay class is used to determine where the touch was made and be able to move the overlay object to anywhere on the map. This however, is causing some problem. The pointer to my current location also becomes movable. I want to fix this current location pointer.

For this, i am creating a new class MyNewLocationOverLay which extends my previously created custom overlay. My plan is to override the onTouchEvent method and return the super.onTouchEvent in case of touching on other overlays and to return true on touch of mylocation overlay. How do I find out what overlay was clicked. I tried:

public class myOverlayclass extends OverLayClass {

    public myOverlayclass(Drawable marker) {
        super(marker);

        // TODO Auto-generated constructor stub
    }

    public boolean onTouchEvent(MotionEvent motionEvent, MapView mapView) {
        System.out.println("The overlays are*************"+mapView.getOverlays()); //this lists the overlays
        return super.onTouchEvent(motionEvent, mapView);
    }
}

I need to compare this to find which overlay was touched. How do I compare overlays.

if (mapView.getOverlays().contains(mYLocationOverLay))

does not seem to work.

  • 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-07T13:04:02+00:00Added an answer on June 7, 2026 at 1:04 pm

    Inside the onTouchEvent method, I performed a hit test to find out which overlay was touched. And compared that to myLocationGeoPoint.

    for(OverlayItem item : overlayItems) 
                        {
                            Point p = new Point();
    
                            mapView.getProjection().toPixels(item.getPoint(), p);
                            item.setMarker(marker);
                            boolean isHit = hitTest(item, marker, x - p.x, y - p.y);
    
                            if(isHit && !(item.getPoint().equals(mylocationgeoPoint))) //this is where I'm checking if I hit my current locating geopoint
                            {
                              //NOW THE OVERLAYS ARE MOVABLE
                                System.out.println("-------------------------inside isHit -----------------------"+item.getPoint() +"my locating geo point is" +mylocationgeoPoint);
    .
    .
    . } 
    }
    

    Hope it helps someone!

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

Sidebar

Related Questions

I have implemented Google Analytics in my iPhone Application. And I can able to
I have implemented an iframe into my flex application. The iframe contains a google
I have successfully implemented code to plot multiple locations on google maps dynamically. Solution:
I'm using the javascript API for Google Maps. It's pretty simple, I just have:
I have a strange problem with my android application. I implemented maps, i got
I have successfuly implemented Google Maps Places V3 autocomplete feature on my input box
I have a class based on google.maps.OverlayView which implements a custom replacement for a
Problem description: I have to develop an application using Dynamic Google Map in Spring
This is related to OpenId authentication. I have implemented the google and yahoo openId
I have implemented a test method with Jersey to run on my Google AppEngine

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.