0

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

michoprogrammer
  • 1,159
  • 2
  • 18
  • 45

2 Answers2

1

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.

Nick Blomberg
  • 73
  • 1
  • 2
  • 7
  • I'm using exactly this to discover my location. After that I use on the map controller object the animateTo() function that animates the map bringing the user on the current location. The problem is that you can see only the map centered on the current location, because if you try to pan the map in other direction after some second automatically comes back! :/ – michoprogrammer May 30 '12 at 15:34
  • If you override the _runOnFirstFix_ method, you should be able to implement your animateTo as a Runnable that you pass to this method. That way, the only time it will perform the animation will be the first time the GPS acquires your co-ordinates. – Nick Blomberg May 30 '12 at 15:48
0

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.

Kat
  • 323
  • 2
  • 8