Hide and Show Tomtom Map Markers

347 Views Asked by At

Adding and showing markers on Tomtom map without using clear() function using this simple logic. Create a boolean variable and change it according to your needs. Buttons will do, just switch the values from true to false or false to true to display.

1

There are 1 best solutions below

0
On BEST ANSWER
 MarkerBuilder marker = new MarkerBuilder(LatLng)
                        .icon(Icon.Factory.fromResources(MainActivity.this, R.drawable.markerIcon))
                        .tag("marker-name");

               if(putMarker == true) {
                    tomtomMap.addMarker(marker);
                } else {
                    tomtomMap.removeMarkerByTag("marker-name");
                }