Android GoogleMap - 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 GoogleMap class.

This code example shows how to use the following methods: animateCamera, setMyLocationEnabled
package com.novoda.mapdemo.fragment; 
 
import android.content.Context; 
import android.location.Location; 
import android.location.LocationManager; 
import android.os.Bundle; 
import android.view.LayoutInflater; 
import android.view.View; 
import android.view.ViewGroup; 
import com.google.android.gms.maps.CameraUpdate; 
import com.google.android.gms.maps.CameraUpdateFactory; 
import com.google.android.gms.maps.GoogleMap; 
import com.google.android.gms.maps.SupportMapFragment; 
import com.google.android.gms.maps.model.LatLng; 
 
public class NovodaMapFragment extends SupportMapFragment {
 
    private static final int ZOOM_LEVEL = 16;
    private GoogleMap map;
 

8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: addMarker, animateCamera, setOnMarkerClickListener, setOnMarkerDragListener
/* 
 * Copyright (C) 2012 The Android Open Source Project 
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at 
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0 
 * 
 * Unless required by applicable law or agreed to in writing, software 
 * distributed under the License is distributed on an "AS IS" BASIS, 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 * See the License for the specific language governing permissions and 
 * limitations under the License. 
 */ 
 
package com.example.mapdemo; 
 
import com.google.android.gms.maps.CameraUpdateFactory; 
import com.google.android.gms.maps.GoogleMap; 

6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: addMarker
              R.string.downtown_club, R.string.heisman_trophy); 
  } 
 
  private void addMarker(GoogleMap map, double lat, double lon,
                         int title, int snippet) {
    map.addMarker(new MarkerOptions().position(new LatLng(lat, lon))
                                     .title(getString(title))
                                     .snippet(getString(snippet)));
  } 
} 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: addCircle, addMarker, clear, getCameraPosition, setLocationSource
	public MapHelperClass(GoogleMap map, int distanceWhenWPReached) {
 
		this.map = map;
		this.distanceWhenWPReached = distanceWhenWPReached;
 
		map.setLocationSource(this);
		map.setMyLocationEnabled(true);
		map.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
 
		CleanMap(); 
	} 
 
	public void RedrawLines() { 
		if (WPPathPolyLine != null) {
			WPPathPolyLine.remove();
			WPPathPolyLine = null;
		} 
		PolylineOptions polylineOptions = new PolylineOptions().color(Color.CYAN).width(4);
		for (Marker m : markers) {
			polylineOptions.add(m.getPosition());

7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setOnCameraChangeListener, setOnMapClickListener, setOnMapLongClickListener
            } 
        } 
    } 
 
    private void setUpMap() { 
        mMap.setOnMapClickListener(this);
        mMap.setOnMapLongClickListener(this);
        mMap.setOnCameraChangeListener(this);
    } 
 
    @Override 
    public void onMapClick(LatLng point) {
        mTapTextView.setText("tapped, point=" + point);
    } 
 
    @Override 
    public void onMapLongClick(LatLng point) {
        mTapTextView.setText("long pressed, point=" + point);
    } 
 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: addMarker
    bar.setListNavigationCallbacks(nav, this);
  } 
 
  private void addMarker(GoogleMap map, double lat, double lon,
                         int title, int snippet) {
    map.addMarker(new MarkerOptions().position(new LatLng(lat, lon))
                                     .title(getString(title))
                                     .snippet(getString(snippet)));
  } 
} 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: animateCamera
 
      LatLng latlng=
          new LatLng(location.getLatitude(), location.getLongitude());
      CameraUpdate cu=CameraUpdateFactory.newLatLng(latlng);
 
      map.animateCamera(cu);
    } 
  } 
 
  @Override 
  public void onProviderDisabled(String provider) {
    // unused 
  } 
 
  @Override 
  public void onProviderEnabled(String provider) {
    // unused 
  } 
 
  @Override 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setMapType
    } 
  } 
 
  @Override 
  public boolean onNavigationItemSelected(int itemPosition, long itemId) {
    map.setMapType(MAP_TYPES[itemPosition]);
 
    return(true); 
  } 
 
  @Override 
  public void onSaveInstanceState(Bundle state) {
    super.onSaveInstanceState(state);
 
    state.putInt(STATE_NAV,
                 getSupportActionBar().getSelectedNavigationIndex()); 
  } 
 
  @Override 
  public void onRestoreInstanceState(Bundle state) {
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setMyLocationEnabled, setOnInfoWindowClickListener, setOnMarkerClickListener
            MapsInitializer.initialize(this);
        } catch (GooglePlayServicesNotAvailableException ex) {
            Log.e("GPS:", "Error" + ex);
        } 
 
        map.setMyLocationEnabled(true);
        map.setOnMarkerClickListener(this);
        map.setOnInfoWindowClickListener(this);
    } 
} 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: addMarker, getUiSettings, moveCamera, setMapType, setMyLocationEnabled
        super.onResume(); 
        setUpMapIfNeeded(); 
    } 
 
    private void setUpMap() { 
        mMap.addMarker(new MarkerOptions().position(new LatLng(37.233305,-76.648709)).title("Canada"));
        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) {
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android GoogleMap Questions & Answers:

Other Android GoogleMap Examples

15:	  static final LatLng HAMBURG = new LatLng(53.558, 9.927);
16:	  static final LatLng KIEL = new LatLng(53.551, 9.993);
17:	  private GoogleMap map;
18:	
19:	  @Override

Read More

1:	
2:		// Google Map
3:		private GoogleMap googleMap;
4:	
5:		@Override

Read More

See Code Examples for Android GoogleMap Methods: