Code example for SupportMapFragment

Methods: getMap

0
 
        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 = getMap();
                // Check if we were successful in obtaining the map. 
                if (mMap != null) {
                    setUpMap(); 
                } 
            } 
        } 
 
        private void setUpMap() { 
            MarkerOptions markerOptions = new MarkerOptions()
                .position(mMarkerPosition)
                .icon(BitmapDescriptorFactory.defaultMarker(mMarkerInfo.mHue))
                .draggable(true);
            mMap.addMarker(markerOptions);
            mMap.setOnMarkerDragListener(this);
            mMap.setOnMarkerClickListener(this);