Marker Popup (Info Window) Remains Open After Marker Is Removed From Map
See original GitHub issueIssue Type
[ x ] Bug
Description and/or steps/code to reproduce the problem
- Create a
Marker
on the map and click on it to open its info window - With the info window open, remove that
Marker
from the map and redraw the map (for example, as the result of a search that is only showing a subset of all markers) - The
Marker
is removed but the info window remains open and visible
I tried overriding several onRemove
type methods to no avail, although this should really be the default behavior. A workaround that we have in place is to close all open info windows when the map overlays are updated, but this shouldn’t be necessary.
FWIW, we are overriding onMarkerClickListener
(to avoid the default map recentering that accompanies the info window being opened), but I don’t see why that would cause this problem.
Environment
Latest version of osmdroid
, Android SDK 33, testing in the Android emulator.
If it’s a bug, version(s) of android this affects:
Not sure. Only tested on one so far.
Version of osmdroid the issue relates to:
6.1.2
Thanks for all the hard work on osmdroid
! This is a really great library.
Issue Analytics
- State:
- Created a year ago
- Comments:9
Top Results From Across the Web
How can I remove an InfoWindow when the Marker is removed?
But if I click on a marker, open an InfoWindow , and then click on a check box to remove the markers of...
Read more >Info Window | Maps JavaScript API - Google Developers
Opens this InfoWindow on the given map. Optionally, an InfoWindow can be associated with an anchor. In the core API, the only anchor...
Read more >Binding problem in infoWindow with Marker - Google Groups
As expected, the InfoWindow opened. 5) Remove the marker from the map through Marker.setMap(null) 6) Well, InfoWindow is still opening there .
Read more >Google Maps API V3: Open (Show) only one InfoWindow at a ...
The solution to this problem is fairly simple. You just need to create one instance of InfoWindow object so that the same InfoWindow...
Read more >Google Maps JavaScript API Episode 4 - Info Windows
In this video series, we will be learning about the Google Maps JavaScript API. We will learn everything about the Google Maps JavaScript ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It is not based on use cases - it’s a drawback of the implementation method. And it’s clearly an issue. InfoWindow.closeAllInfoWindowsOn is just an awful workaround. But I also know that it’s clearly “extra work” to achieve the non-strange result.
Have a look at #397 :
“Marker should have a factory-method to create an InfoWindow on demand instead of containing a precreated InfoWindow . The object “InfoWindow” should only exist as long as the popup-bubble is opend.”
By the way, this is not specific to Marker, but to all OverlayWithIW.
Ideas and PRs are welcomed, but keep in mind that a rework on this class may have serious impacts on users who implemented subclasses of Markers, made customized infowindows, etc.
Sure, but what’s strange shouldn’t be the default behavior 😄. I think it’s reasonable to expect that the popup is removed with the marker. If you want to change that behavior for some strange reason, then having a way to disable that would be fine. But ideally it shouldn’t be extra work to achieve the non-strange result.