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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:05:30+00:00 2026-05-26T22:05:30+00:00

I’m fighting with following problem now: I add a simple overlay to my mapview.

  • 0

I’m fighting with following problem now:
I add a simple overlay to my mapview. It doesn’t draw anything, it is just a help overlay for detecting scroll is ended (see response)

Here is the code of it:

public class ScrollDetectionOverlay extends Overlay
{
    private static GeoPoint lastLatLon = new GeoPoint(0, 0);
    private static GeoPoint currLatLon;

    protected boolean isMapMoving = false;

    private MapScrollingFinishedListener listener = null;

    public void setListener(MapScrollingFinishedListener listener)
    {
        this.listener = listener;
    }

    @Override
    public boolean onTouchEvent(MotionEvent e, MapView mapView)
    {
        super.onTouchEvent(e, mapView);
        if (e.getAction() == MotionEvent.ACTION_UP)
        {
            isMapMoving = true;
        }
        return true;
    }

    @Override
    public void draw(Canvas canvas, MapView mapView, boolean shadow)
    {
        super.draw(canvas, mapView, shadow);
        if (!shadow)
        {
            if (isMapMoving)
            {
                currLatLon = mapView.getProjection().fromPixels(0, 0);
                if (currLatLon.equals(lastLatLon))
                {
                    isMapMoving = false;
                    listener.onScrollingFinished();
                }
                else
                {
                    lastLatLon = currLatLon;
                }
            }
        }
    }
}

If I’m adding this overlay to my mapview, I can’t scroll the map anymore. Below is the code for adding and removing of the overlay from the mapview:

@Override
protected void onResume()
{
    super.onResume();
    if (!getMapView().getOverlays().contains(scrollDetectionOverlay))
    {
        scrollDetectionOverlay = new ScrollDetectionOverlay();
        scrollDetectionOverlay.setListener(this);
        getMapView().getOverlays().add(scrollDetectionOverlay);
    }
}

@Override
protected void onPause()
{
    super.onPause();
    if (getMapView().getOverlays().contains(scrollDetectionOverlay))
    {
        getMapView().getOverlays().remove(scrollDetectionOverlay);
        scrollDetectionOverlay = null;
    }
}

What do I’m wrong?

And another thing I noticed. The draw-method of overlay will be called, and called, and called, without user does anything. Some reason for it?

Thank you.

  • 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-26T22:05:30+00:00Added an answer on May 26, 2026 at 10:05 pm

    You’re returning true on the touch event for the overlay. When you return true, the touch event stops cascading down to the lower views. Thus, your MapView never receives it. You only want to do that if the touch has been completely handled and you don’t want to do anything more. If you want the map to move, you may try changing the return statement to return super.onTouchEvent(e, mapView);

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

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
Seemingly simple, but I cannot find anything relevant on the web. What is the
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

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.