how to zoom and add marker to android mapfragment
android, google-maps
Solution
To get map instance in code do this:
map = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
or:
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
depending on whether you used `SupportMapFragment` or `MapFragment` in your XML file.
Then to 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 zoom the map:
CameraPosition cameraPosition = new CameraPosition.Builder().target(latlng).zoom(14.0f).build();
CameraUpdate cameraUpdate = CameraUpdateFactory.newCameraPosition(cameraPosition);
map.moveCamera(cameraUpdate);
Problem
I am displaying a map at my android application (google maps api v2). I want to manipulate the map in order to show a specific location, zoom and marker. can anyone give an example of manipulation mapfragment