Issue
This Content is from Stack Overflow. Question asked by Jarek Palomino
I need the “else” part to delete the bookmarks created only by that button.
I have used the map.clear() parameter, but it deletes the entire map and since I have other buttons that I want to perform the same function, I need to individually remove the markers that each button creates
val dominos: ToggleButton = findViewById(R.id.btndominos)
// set on-click listener
dominos.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
val coordenadas = LatLng(40.320360, -3.865281)
val marker: MarkerOptions =
MarkerOptions().position(coordenadas).title("Dominos Pizza Mostoles")
.icon(BitmapDescriptorFactory.fromResource(R.drawable.dominospizza))
mapa.addMarker(marker)
} else {
??
}
}
Solution
This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.
This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.