0

I am using android MapView

I want to trigger some event when map view is panned if user is panning through it should get triggered at the end of set of panning

I need to make a http call to pull some data based on the map view user has currently at the end of panning that is why I need to listen to that panning end event

user602865
  • 261
  • 2
  • 5
  • 10

1 Answers1

1

There is no built-in method to get such events. But you can try MapView Overlay Manager to listen to some gestures. Or write your own class extends from MapView to catch touch events from user.

EDIT:

For extending a Mapview, override the onTouchEvent method.

public boolean onTouchEvent(MotionEvent ev) {
    if (ev.getAction() == MotionEvent.ACTION_UP) {
        GeoPoint centerGeoPoint = this.getMapCenter();
        if (currentCenter == null || 
                (currentCenter.getLatitudeE6() != centerGeoPoint.getLatitudeE6()) ||
                (currentCenter.getLongitudeE6() != centerGeoPoint.getLongitudeE6()) ) {
            firePanEvent(currentCenter, this.getMapCenter());
        }
        currentCenter = this.getMapCenter();
    }
    return super.onTouchEvent(ev);
}
StarPinkER
  • 14,081
  • 7
  • 55
  • 81