Search code examples
androidanimationcontrollerpointmapactivity

How to animate to other position that center map


I have an activity that extends MapActivity, and inside onCreate() I have this code

 GeoPoint point = new GeoPoint((int)(1.3*1E6),(int)(34.45*1E6)); 
 final MapController mc;
 mc.animateTo(point);

that animates, to that point, however, when it animates, the point is in the center of the screen, and I want it to be in a fixed (X,Y) position on the screen. Is there an mc.animatetoLeftBottom(point) function?

Edit : I used the Projection p = mapView.getProjection(); point = p.fromPixels(50, 60); mc.animateTo(point);

pictures: When I start the app, it looks like this :

initial

After I tap once on the pin, it looks like this

after one tap

And, if I tap again on the pin, it will look like this:

after two taps

This is how it should look like, no matter where I tap it from, or if I scroll, zoom and then tap again:

how it should be

What I want is for it to automatically move to that position(see last picture) when I tap the pin


Solution

  • Can't you just change the GeoPoint to account for the fact, and animate to a different point?