Android SupportMapFragment - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android SupportMapFragment class.

This code example shows how to use the following methods:getMap
 
    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 = mMapFragment.getMap(); 
            // Check if we were successful in obtaining the map. 
            if (mMap != null) { 
                setUpMap(); 
            } 
        } 
    } 
 
    private void setUpMap() { 
        mMap.addMarker(new MarkerOptions().position(new LatLng(0, 0)).title("Marker")); 
    } 
} 
5
CodeRank
This code example shows how to use the following methods:getMap
	@Override 
	protected void onResume() { 
		super.onResume(); 
 
		if (map == null) {
			map = mapFragment.getMap();
			if (map != null) {
				setupMap(); 
			} 
		} 
	} 
 
	@OptionsItem 
	void MenuSettings() { 
 
	} 
 
	void setupMap() { 
		List<MarkerOptions> list = new ArrayList<MarkerOptions>();
		list.add(new MarkerOptions()
4
CodeRank
This code example shows how to use the following methods:getMap
		super(context);
		this.mapFragment = mapFragment;
	} 
 
	public void init(){ 
		this.map = mapFragment.getMap();
		this.map.setMyLocationEnabled(true);
		UiSettings settings = this.map.getUiSettings();
		settings.setMyLocationButtonEnabled(true);
 
		// カメラを現在位置にフォーカスする 
		map.setOnMyLocationChangeListener(new OnMyLocationChangeListener(){
		      @Override 
		      public void onMyLocationChange(Location location) {
		    	  moveCamera(location.getLatitude(), location.getLongitude(), 15);
		    	  map.setOnMyLocationChangeListener(null); // 一回移動したらリスナーを殺す
		      } 
		});     
	} 
	 
4
CodeRank
This code example shows how to use the following methods:getMap
		SupportGoogleMap map = new SupportGoogleMap(context, mapFragment.getMap());
		return map;
	} 
	 
	public static SupportGoogleMap newInstance(Context context, SupportMapFragment mapFragment) throws NoPlayServicesFoundException{
		SupportGoogleMap map = new SupportGoogleMap(context, mapFragment.getMap());
		return map;
	} 
	 
	public static SupportGoogleMap newInstance(Context context, GoogleMap map) throws NoPlayServicesFoundException{
		SupportGoogleMap mapInstance = new SupportGoogleMap(context, map);
		return mapInstance;
	} 
	 
	/** 
	 * Set whether SupportGoogleMap should remember and load last CameraPosition 
	 * of the GoogleMap, which includes latitude, longitude, zoom level. 
	 * Enabled by default. 
	 * @param enabled true to use this feature, false to disable. 
	 */ 
3
CodeRank
This code example shows how to use the following methods:getMap
 
    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 = mMapFragment.getMap(); 
            // Check if we were successful in obtaining the map. 
            if (mMap != null) { 
                setUpMap(); 
            } 
        } 
    } 
 
    private void setUpMap() { 
    	 
    	 mMap.addMarker(new MarkerOptions().position(new LatLng(0, 0)).title(title)); 
		  
 		//mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng( 
 				//0, 0), 12.0f)); 
 		 
4
CodeRank
This code example shows how to use the following methods:
    static final LatLng HAMBURG = new LatLng(53.558, 9.927); 
 
    public void onCreate(Bundle savedInstanceState) { 
        super.onCreate(savedInstanceState); 
 
        SupportMapFragment mMapFragment = new SupportMapFragment(); 
        getSupportFragmentManager().beginTransaction() 
                .add(android.R.id.content, mMapFragment).commit(); 
 
        /* if(mMapFragment != null){ 
            GoogleMap map = mMapFragment.getMap(); 
 
            Marker hamburg = map.addMarker(new MarkerOptions().position(HAMBURG) 
                    .title("Hamburg")); 
        } 
        */ 
    } 
} 
5
CodeRank
This code example shows how to use the following methods:getMap
	public void setMap(int map) {
 
		//Log.i("a", ""+map + "..." + fm.toString()); 
		Fragment fragment1 = fm.findFragmentById(map);
		SupportMapFragment mapFragment = (SupportMapFragment) fragment1;
		mMap = mapFragment.getMap();
 
	} 
 
 
} 
4
CodeRank
This code example shows how to use the following methods:
	@Override 
	protected void onCreate(Bundle savedInstanceState) { 
		super.onCreate(savedInstanceState); 
		//setContentView(R.layout.activity_main); 
		 
		SupportMapFragment fragment = new SupportMapFragment(); 
		getSupportFragmentManager().beginTransaction().add(android.R.id.content, fragment).commit(); 
	} 
 
 
} 
5
CodeRank
This code example shows how to use the following methods:getMap
 
	private void setupMap() { 
		if (map != null) {
			return; 
		} 
		map = mapFragment.getMap();
		if (map == null) {
			return; 
		} 
 
		doZoom(); 
	} 
 
	private void doZoom() { 
		if (map != null) {
			map.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(
					45.424900, -75.694968), 17)); 
		} 
	} 
} 
4
CodeRank
This code example shows how to use the following methods:
 
    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
        super.onCreate(savedInstanceState); 
 
        SupportMapFragment fragment = new SupportMapFragment(); 
        getSupportFragmentManager().beginTransaction() 
                .add(android.R.id.content, fragment).commit(); 
    } 
} 
5
CodeRank

Related Android SupportMapFragment Questions & Answers:

See Code Examples for Android SupportMapFragment Methods: