Question about adding/removing/revising a route

Hello there,

I found another question.

Currently I am adding a route like below.

RouteBuilder routeBuilder = new RouteBuilder(model.getCoordinates()) .style(routeStyle);
Routes route = tomtomMap.addRoute(routeBuilder);

And I am trying to update the route when more coordinates are added in the model object.

In order to do that, I am trying to find a way to remove the specific route from the map, and add a new route with the updated coordinates.

But when I look at the methods in the class, I only see a way to clear all routes, not just removing a single route. Because I want to keep some other routes, this method won’t work for me.

What would be a good way to achieve this?

Hi again!

Yes, as of right now there is no available method to remove single route in Android SDK. I will pass the idea to the team so it can be planned and added to the API.

Meanwhile you could try to experiment with updating the route style using:

tomtomMap.routeSettings.updateRouteStyle(long routeId, RouteStyle routeStyle)

And create a RouteStyle with RouteStyleBuilder. Route style allows you to specify width of a route and colors. I wonder if a workaround for your current problem would be to set outline & fill color to Color.Transparent and width of a route to 0.0

Hi Damian,

Thank you for another reply/help.

I’ll try the workaround with RouteStyle and RouteStyleBuilder.