To get an instance of the card in code, do the following:
map = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
or
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
depending on whether you use SupportMapFragmentor MapFragmentin your xml file.
Then add a marker to it:
Marker newmarker = map.addMarker(new MarkerOptions().position(latlng).title("marker title").icon(BitmapDescriptorFactory.fromResource(R.drawable.marker_for_map_purpul)));
To enlarge the map:
CameraPosition cameraPosition = new CameraPosition.Builder().target(latlng).zoom(14.0f).build();
CameraUpdate cameraUpdate = CameraUpdateFactory.newCameraPosition(cameraPosition);
map.moveCamera(cameraUpdate);
source
share