Code example for PolygonOptions

0
        super.onActivityCreated(savedInstanceState);
        setUpMapIfNeeded(); 
    } 
 
    private void setUpMapIfNeeded() { 
        PolygonOptions rectOptions = new PolygonOptions()
                .add(new LatLng(37.35, -122.0),
                        new LatLng(37.45, -122.0),
                        new LatLng(37.45, -122.2));
        if (map == null) {
            map = this.getMap();
            if (map != null) {
                map.addMarker(new MarkerOptions().position(new LatLng(37.35, -122.0)).title("Hello World"));
                map.addMarker(new MarkerOptions().position(new LatLng(37.45, -122.0)).title("Hello World"));
                map.addMarker(new MarkerOptions().position(new LatLng(37.45, -122.2)).title("Hello World"));
                map.addPolygon(rectOptions);
            } 
            requestPath(); 
        } 
    }