I'm using a custom InfoWindow adapter class for my markers to handle when the user presses on the icon to display some information:
mapView.setInfoWindowAdapter(new CustomMarkerInfoWindowAdapter(downloadService, getLayoutInflater(), markersList));
Relevant snippet from my custom InfoWindowAdapter:
@Override
public View getInfoContents(Marker marker) {
final View currentView = inflater.inflate(R.layout.custommarker, null);
final TextView textThing = (TextView) currentView.findViewById(R.id.markerInfoThing);
textThing.setText("Downloading data...");
new Thread() {
public void run() {
Thing thing = downloadService.getThing(thingId);
// this doesn't work - and yes thing.getName() returns a valid string
textThing.setText(thing.getName());
}
}.start();
return currentView;
}
The second call to setText
doesn't occur until after getInfoContents
has returned and the TextView on the InfoWindow is never updated. I noticed there are no other functions (such as notifyDataHasChanged
) in GoogleMap.InfoWindowAdapter
to override, therefore I'm wondering if it's possible to do this?