Code example for MapFragment

Methods: getMap

0
    CameraPosition cameraPosition = new CameraPosition.Builder().target(latLang) // Sets the center of the map to Mountain View
                                                                .zoom(17)
                                                                // Sets the zoom 
                                                                .build();
    // Creates a CameraPosition from the builder 
    getMap().animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
  } 
 
  /** 
   * Adds a point to the polyline drawn on the map 
   *  
   * @param location 
   */ 
  public void addPointToPolyline(LatLng latLng) {
 
    // Instantiates a new Polyline object and adds points to define a rectangle 
    if (poly == null) {
      poly = new PolylineOptions().width(40).color(Color.RED).geodesic(true);
    } 
    poly.add(latLng);