unpix
unpix

Reputation: 853

MapView start position

Good afternoon,

When i'm starting my application, the mapview is showed like you can see in the follow picture :

enter image description here

but i would like to start the mapview with some zoom in some point, something similar to this :

enter image description here

Which method i need to use?

Thanks in advance.

Upvotes: 1

Views: 452

Answers (4)

span
span

Reputation: 5628

You add a zoom level to the map controller:

mapView.getController().setZoom(17); // an int that suits you

Read more about zoom levels here: https://developers.google.com/maps/documentation/staticmaps/#Zoomlevels

To set center you can use:

 mapView.getController().setCenter(new GeoPoint(latitude,longitude));

Upvotes: 3

yuva ツ
yuva ツ

Reputation: 3703

for displaying egypt use it-

  String coordinates[] = {"18.352566007", "73.78921587"};//here you can set geopoints of egypt
    double lat = Double.parseDouble(coordinates[0]);
    double lng = Double.parseDouble(coordinates[1]);

    p = new GeoPoint(
        (int) (lat * 1E6), 
        (int) (lng * 1E6));//p is GeoPoint

    mc.animateTo(p);
    mc.setZoom(17); 
    mapView.invalidate();

Upvotes: 0

unpix
unpix

Reputation: 853

 mapView.getController().setZoom(17); // an int that suits you
 mapView.getController().setCenter(new GeoPoint(latitude,longitude));

This is the solution.

Upvotes: 0

yuva ツ
yuva ツ

Reputation: 3703

set -

mapView.setStreetView(true);

Upvotes: 0

Related Questions