Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the Map Extent change event in OSMdroid?

I am using the Osmdroid library in my custom Android App.

At every extent change (& when the map is zoomed in) I want to query the sqlite database and get records that lie within that extent. For this I need something similar to a Map Extent change event.

I could not find such an event on the MapView Class. How Do I achieve what I want to do?

UPDATE I am using the MapListner like this:

mapView.setMapListener(new MapListener() {   
    public boolean onZoom(ZoomEvent arg0) {
        return false;
    }

    public boolean onScroll(ScrollEvent arg0) {
         onExtentChange();
        return false;
    }
} );

but the onScrollEvnt is fired several times for each pan of the map. How do I get the last or final scrollEvent?

like image 914
Devdatta Tengshe Avatar asked Apr 09 '13 03:04

Devdatta Tengshe


1 Answers

setMapListener(new DelayedMapListener(new MapListener() {  
    public boolean onZoom(final ZoomEvent e) {
        //do something
        return true;
    }

    public boolean onScroll(final ScrollEvent e) {
        Log.i("zoom", e.toString());
        return true;
    }
    }, 1000 ));
like image 116
manimaul Avatar answered Oct 06 '22 21:10

manimaul