B4J Question Using a map to remove a Marker from GoogleMaps

Declan

Well-Known Member
Licensed User
Longtime User
I am using the following code to display a Marker on GoogleMaps:
B4X:
            Dim cp As CameraPosition
            cp.Initialize(myLat, myLon, 16)
            mkr = GMap.AddMarker2(myLat, myLon, markerTxt,File.GetUri(File.DirAssets, "othermark.png"))
            GMap.MoveCamera(cp)
            mapMarkers.Put(myFriendname, mkr)
I write the Device unique ID "myFriendname" as the Key of mapMarkers map and marker details as the Value of mapMarkers.
I must now remove the Marker from the GoogleMaps using:
B4X:
GMap.RemoveMarker(m)
Where m is the Marker displayed on GoogleMaps.
 

DonManfred

Expert
Licensed User
Longtime User
Start learning B4X.

To use
B4X:
GMap.RemoveMarker(m)
you need to get the markerobject first.
I don´t see you getting it from the Map? Why not?

B4X:
dim m as marker = mapMarkers.get(myfriendname)
GMap.RemoveMarker(m)
 
Upvote 1
Top