- Code: Select all
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//Displaying the map
mapView = (MapView) findViewById(R.id.googleMap);
LinearLayout zoomLayout = (LinearLayout)findViewById(R.id.zoomControls);
View zoomView = mapView.getZoomControls();
//Setting the zoom controls
zoomLayout.addView(zoomView,
new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT));
mapView.displayZoomControls(true);
mapView.setStreetView(true);
//Setting the default zoom view
mc = mapView.getController();
String coordinates[] = {"14.069315", "121.323738"};
double lat = Double.parseDouble(coordinates[0]);
double lng = Double.parseDouble(coordinates[1]);
p = new GeoPoint(
(int) (lat * 1E6),
(int) (lng * 1E6));
mc.animateTo(p);
mc.setZoom(15);
mapView.invalidate();
How can I add markers using coordinates (Longitude and Latitude)?

