https://kotlinlang.org logo
#android
Title
# android
l

lawlorslaw

06/29/2018, 4:34 PM
i tried to use databinding to do some late binding of some data to an GoogleMap infowindow. but that doesn’t look like it will work. Is there any other work around to update an infowindow after it is showing?
l

Lucas Ł

06/30/2018, 10:18 AM
It's basically impossible to make changes to the contents of a infowindow. The only thing you can do is, make the change to a viewmodel (or whatever you're using to populate it), and "re-show" it From the infowindow documentation
Note: The info window that is drawn is not a live view. The view is rendered as an image (using View.draw(Canvas)) at the time it is returned. This means that any subsequent changes to the view will not be reflected by the info window on the map. To update the info window later (for example, after an image has loaded), call showInfoWindow()...
You can read the whole thing here: https://developers.google.com/maps/documentation/android-sdk/infowindows#custom_info_windows
l

lawlorslaw

06/30/2018, 4:47 PM
hmm, ya i just tried doing this but you get in an infinite loop if you call showInfoWindow() inside of the getInfoContent() function of the GoogleMap.InfoWindowAdapter interface.
looks like i need to do that outside
okay i found a work around
im using rxjava publish subject and inside the subscribe call i call showInfoWindow()
👍 1
4 Views