android-studioiconsmarkerstomtomtomtom-android-sdk

Hide and Show Tomtom Map Markers


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.


Solution

  •  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");
                    }