michoprogrammer
michoprogrammer

Reputation: 1199

Android map: How to stop and start animateTo()

I'm trying to control the animation of the android map, but I don't know how to do. Into my locationlistener I set animateTo() on the point of my location and it works great. What I want to do is animate the point of my location only the first time when you open the map. Right now the animation works, but I can't pan the map, because when you try to pan the map after a moment automatically pan back on my position and this is very annoying! How can I handle this? I'd like to see my position when I start the map the first time and when I resume the activity, but after this I'd like to pan the map and see what I want!

Thanks for the help

Upvotes: 0

Views: 429

Answers (2)

Nick Blomberg
Nick Blomberg

Reputation: 73

I'm not sure if this is appropriate for your usage, but you could utilise the existing MyLocationOverlay class for showing the current position. This class has a runOnFirstFix method, which you could use to move to the initial co-ordinates obtained when the GPS locks.

Upvotes: 1

Kat
Kat

Reputation: 343

Have you set the setBuiltInZoomControls(true)?

Do this at the end of the onCreate() method:

MapView mapView = (MapView) findViewById(R.id.mapview); mapView.setBuiltInZoomControls(true);

I'm not sure if you just want to be able to pan/zoom the map after it's been shown, but if so this should solve your problem.

Upvotes: 0

Related Questions