Skip to content

Instantly share code, notes, and snippets.

@MohammadSamandari
Created March 31, 2019 12:07
Show Gist options
  • Save MohammadSamandari/c34126289f75b3ad634366a22f827dbe to your computer and use it in GitHub Desktop.
Save MohammadSamandari/c34126289f75b3ad634366a22f827dbe to your computer and use it in GitHub Desktop.
Learning: Working With Google Map
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
// Add a marker in Sydney and move the camera
LatLng sydney = new LatLng(-34, 151);
mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
// Start By Creating a new location to center our map On:
LatLng myHomeLocation = new LatLng(32.8201905, 51.5152217);
mMap.addMarker(new MarkerOptions().position(myHomeLocation).title("My Home"));
mMap.moveCamera(CameraUpdateFactory.newLatLng(myHomeLocation));
// Customizing The Icon of the Marker.
mMap.addMarker(new MarkerOptions()
.position(myHomeLocation)
.title("My Home"))
.setIcon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE));
// To Zoom in: it ranges from 1 - 20
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(myHomeLocation, 13));
// Adding Satellite Imagery and other things to the map.
mMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment