public static Marker placeRobotMarkerOnMap( Marker marker, GoogleMap mMap, LatLng location, boolean animateTheCamera, Resources res, Context context) { try { marker.remove(); } catch (Exception e) { e.printStackTrace(); Log.e("MapUtilities", "placeMarkerOnMapUserLatLng: Could not remove Robots Marker"); } MarkerOptions m = new MarkerOptions() .position(location) .icon(BitmapDescriptorFactory.fromResource(R.drawable.robot)) .title("ROBOT"); marker = mMap.addMarker(m); marker.showInfoWindow(); if (animateTheCamera) animateCameraLatLng(mMap, location, res); Log.d("ROBOT_LOCATION", "Latitude: " + location.latitude + " Longitude: " + location.longitude); // Toast.makeText(context,"Latitude: " +location.latitude+" Longitude: // "+location.longitude,Toast.LENGTH_LONG).show(); return marker; }
public static void placeMarkerOnMapLatLng( GoogleMap mMap, LatLng location, String markerInfo, boolean visited, boolean systemDefined, Resources res) { if (visited) { if (systemDefined) mMap.addMarker( new MarkerOptions() .position(location) .title(markerInfo) .flat(false) .icon(BitmapDescriptorFactory.fromResource(R.drawable.system_marker_blue))) .showInfoWindow(); else mMap.addMarker( new MarkerOptions() .position(location) .title(markerInfo) .flat(false) .icon(BitmapDescriptorFactory.fromResource(R.drawable.grey_marker))) .showInfoWindow(); } else { if (systemDefined) mMap.addMarker( new MarkerOptions() .position(location) .title(markerInfo) .flat(false) .icon(BitmapDescriptorFactory.fromResource(R.drawable.system_marker_green))) .showInfoWindow(); else mMap.addMarker( new MarkerOptions() .position(location) .title(markerInfo) .flat(false) .icon(BitmapDescriptorFactory.fromResource(R.drawable.green_marker))) .showInfoWindow(); } animateCameraLatLng(mMap, location, res); }