1. Here's my initial thoughts (but strike that, it won't be
sufficient)
Subclass MapView, and override onTouchEvent() as well as
onTrackballEvent().
The latter to cover cases where users use the trackball to manipulate
the MapView.
A MotionEvent is passed to these methods which allows the capture of
ACTION_UP events, among others. Read out the map center with
MapView.getMapCenter().
I haven't verified this - you might receive ACTION_UP events when the
user operates the zoom controls. This shouldn't hurt with your
particular use case, because map zooming anchors at the map center.
An extra challenge might be relating to pinch-to-zoom. You may have to
get a device that allows you to study how the sequence of calls to
onTouchEvent() occur.

2. ...insufficient, because in many cases the map center will keep on
be moving on, after the ACTION_UP event, before it eventually settles
in a location.
What I would try then is the indirect method of tracking the map
center in an overridden MapOverlay.draw(). You can determine the speed
at which the map moves, and when it settles down at a threshold,
execute that call for fresh data. This is a general solution, i.e.
will also cover pinch-to-zoom, users not lifting the finger while
moving the map center around, the use of the trackball, and all sorts
of other ways to manipulate the map, including you calling
MapController.animateTo().
There's a residual chance that you don't receive that final .draw() to
trigger the call for data when it would be warranted. A Thread that
checks for such cases at, say, 200ms intervals, could be used to pick
up such cases. Or, use that Thread exclusively to monitor the speed at
which the map moves.

JP





On Apr 3, 2:49 am, Nick Giancola <[email protected]> wrote:
> Hey all-
>
> I need to know when the user is panning the map so I can check if they've 
> panned outside of the initial radius that I fetch data from the API with when 
> the app launches. If the user pans outside this radius, when they stop 
> panning I will get the new center point of the map and fetch new data with 
> that geo-point. So far I can't find anything in the Google Maps API docs [and 
> I've inspected the entire class tree] that notifies developers when any 
> animation actions are occurring or completed.. It seems weird that Google 
> wouldn't give us some sort of event listener or protected method to override 
> on the MapView or something to do this.
>
> I looked into what methods were available to override on the View class and 
> it does have onAnimationEnd() but I guess panning or zooming the map doesn't 
> count as an animation or is never passed up from the MapView or something... 
> I tried running a simple log in onAnimationEnd() and it is never being 
> called...
>
> Any help here would be great! Searching the interwebs gave me nothing but 
> some never-successfully-answered posts.
>
> Thanks so much,
> Nick

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe, reply using "remove me" as the subject.

Reply via email to