0
votes

I am working on upgrading an old android app that uses Mapbox from SDK 4 to SDK 6.1.3. I must change the color of the markers to match the bus route colors in the city. I can not find a code that works for this version of SDK.

Can any one help?

1
It's not clear what you're asking. Is it Mapbox-GL-JS, or Mapbox GL native, or mapbox.js, or what? Including your code would help. - Steve Bennett
Steve, I am looking for the solution for Java. I removed the tags for JS. Thanks. - alcor s

1 Answers

1
votes

Your map box init in onCreate

        map = mapboxMap;
        mapboxMap.addPolygon(generatePerimeter(new LatLng(trackLat, trackLong), 0.200, 64));

Your Method

private PolygonOptions generatePerimeter(LatLng centerCoordinates, double radiusInKilometers, int numberOfSides) {
    List<LatLng> positions = new ArrayList<>();
    return new PolygonOptions()
            .addAll(positions)
            .fillColor(Color.GREEN)
            .strokeColor(Color.YELLOW)
            .alpha(1f);
}