Note that there are some explanatory texts on larger screens.

plurals
  1. PODynamic contents in Maps V2 InfoWindow
    text
    copied!<p>I want to show an InfoWindow on markers in a Maps V2 fragment. Thing is, I want to show BitMaps that are dynamically loaded from the web with <a href="https://github.com/nostra13/Android-Universal-Image-Loader">Universal Image Downloader</a>. </p> <p>This is my InfoWindowAdapter: </p> <pre><code>class MyInfoWindowAdapter implements InfoWindowAdapter { private final View v; MyInfoWindowAdapter() { v = getLayoutInflater().inflate(R.layout.infowindow_map, null); } @Override public View getInfoContents(Marker marker) { Item i = items.get(marker.getId()); TextView tv1 = (TextView) v.findViewById(R.id.textView1); ImageView iv = (ImageView) v.findViewById(R.id.imageView1); tv1.setText(i.getTitle()); DisplayImageOptions options = new DisplayImageOptions.Builder() .delayBeforeLoading(5000).build(); imageLoader.getMemoryCache(); imageLoader.displayImage(i.getThumbnailUrl(), iv, options, new ImageLoadingListener() { @Override public void onLoadingStarted(String imageUri, View view) { // TODO Auto-generated method stub } @Override public void onLoadingFailed(String imageUri, View view, FailReason failReason) { // TODO Auto-generated method stub } @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { Log.d("MAP", "Image loaded " + imageUri); } @Override public void onLoadingCancelled(String imageUri, View view) { // TODO Auto-generated method stub } }); return v; } @Override public View getInfoWindow(Marker marker) { // TODO Auto-generated method stub return null; } } </code></pre> <p>I have 2 problems with this: </p> <p>As we <a href="https://developers.google.com/maps/documentation/android/marker#info_window_click_events">know</a> the <code>InfoWindow</code> is drawn and later changes to it (in my case the new <code>BitMap</code> on the <code>ImageView</code>) are not shown/ the <code>InfoWindow</code> is not being updated. How can I "notify" the InfoWindow to reload itself when the <code>imageLoader</code> has finished? When I put</p> <pre><code>marker.showInfoWindow() </code></pre> <p>into <code>onLoadingComplete</code> it created an infinite loop where the marker will pop up, start loading the image, pop itself up etc. </p> <p>My second problem is that on a slow network connection (simulated with the 5000ms delay in the code), the <code>ImageView</code> in the <code>InfoWindow</code> will always display the last loaded image, no matter if that image belongs to that <code>ImageWindow</code>/ <code>Marker</code>. </p> <p>Any suggestions on how to propperly implement this?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload