Shah
Shah

Reputation: 5020

MapActivity does not take me to the exact location

Friends i am making an application in which i am using Map Activity.

Now i have settles all Code using the following link:

http://developer.android.com/resources/tutorials/views/hello-mapview.html

it gives ma an overlay on to the location as well. but when i zoom the map using

mapView.getController().setZoom(17); 

Then it takes me to some other place not to the exact location where the overlay has been marked. So how do i take the map to that position?

Pleae Help

Upvotes: 0

Views: 150

Answers (2)

Pratik
Pratik

Reputation: 30855

To move the map location and fit and zoom to the location use

mapPoint = new GeoPoint((int) (21.232624 * 1E6), (int) (69.323265 * 1E6));
mc = mapView.getController();
mc.zoomToSpan((maxlat-minlat),(maxLng-minLng));
mc.animateTo(mapPoint);

and no need to specify the zoom level after this it's automatically zoom and span to that location

Upvotes: 1

Sujit
Sujit

Reputation: 10622

Have you added the animateTo(point) to move the your current location to this particular GeoPoint . and point here is GeoPoint of your current location.

Upvotes: 1

Related Questions