Code example for GoogleMap

Methods: addMarker, getUiSettings, moveCamera, setMapType, setMyLocationEnabled

0
        super.onResume(); 
        setUpMapIfNeeded(); 
    } 
 
    private void setUpMap() { 
        mMap.addMarker(new MarkerOptions().position(new LatLng(37.233677,-76.644332)).title("Italy"));
        mMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
        mMap.setMyLocationEnabled(false);
        mMap.getUiSettings().setZoomControlsEnabled(false);
        mMap.moveCamera(CameraUpdateFactory.newCameraPosition(HOME));
    } 
 
    private void setUpMapIfNeeded() { 
        // Do a null check to confirm that we have not already instantiated the map. 
        if (mMap == null) {
            // Try to obtain the map from the SupportMapFragment. 
            mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map))
                    .getMap();
            // Check if we were successful in obtaining the map. 
            if (mMap != null) {
                setUpMap();