It looks like getInfoContents
is returning the View
before the data has been downloaded, and because of that, the TextView
is not updated.
You should download the content first, and update the InfoWindow
after you have it downloaded. You can accomplish this by using AsyncTask
, and you can show the InfoWindow
on the onPostExecute
method call, and for that, you will need to keep track of the current Marker
.
See these links:
- How to image from url into InfoWindowAdapter android?
- I my using google mapV2 and i m downloading image from google place api and want to display in the popup.
- How to check if an Google Maps InfoWindow is still displayed before updating it?
There is also this approach from this answer:
You should be doing
Marker.showInfoWindow()
on marker that is currently showing info window when you receive model update.So you need to do 3 things:
- create model and not put all the downloading into
CustomMarkerInfoWindowAdapter
- save reference to
Marker
(call itmarkerShowingInfoWindow
) fromgetInfoContents(Marker marker)
when model notifies you of download complete, call
if (markerShowingInfoWindow != null && markerShowingInfoWindow.isShowingInfoWindow()) { markerShowingInfoWindow.showInfoWindow(); }
Hope this helps you.