Change current location marker icon

This commit is contained in:
neslihanturan 2018-03-16 18:48:15 +03:00
parent 41e11b7f20
commit 0e11a00025
2 changed files with 7 additions and 1 deletions

View file

@ -30,6 +30,8 @@ import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import com.mapbox.mapboxsdk.Mapbox;
import com.mapbox.mapboxsdk.annotations.Icon;
import com.mapbox.mapboxsdk.annotations.IconFactory;
import com.mapbox.mapboxsdk.annotations.Marker;
import com.mapbox.mapboxsdk.annotations.MarkerOptions;
import com.mapbox.mapboxsdk.annotations.PolygonOptions;
@ -421,10 +423,14 @@ public class NearbyMapFragment extends DaggerFragment {
if (currentLocationMarker != null) {
currentLocationMarker.remove(); // Remove previous marker, we are not Hansel and Gretel
}
Icon icon = IconFactory.getInstance(getContext()).fromResource(R.drawable.current_location_marker);
MarkerOptions currentLocationMarkerOptions = new MarkerOptions()
.position(new LatLng(curLatLng.getLatitude(), curLatLng.getLongitude()));
currentLocationMarker = mapboxMap.addMarker(currentLocationMarkerOptions);
currentLocationMarkerOptions.setIcon(icon); // Set custom icon
currentLocationMarker = mapboxMap.addMarker(currentLocationMarkerOptions);
List<LatLng> circle = createCircleArray(curLatLng.getLatitude(), curLatLng.getLongitude(),
curLatLng.getAccuracy() * 2, 100);

Binary file not shown.

After

Width:  |  Height:  |  Size: 882 B