2


I'm using Google maps APIv2 for android. I've implemented MapFragment, put markers where I need, added custom InfoWindow for markers.

The issue is - I have AsyncImages in my InfoWindow and have ProgressBar there. The thing is - ProgressBar doesn't spin, and Image doesn't set after I got it from cache. AsyncImages does work well. I've tested it into another class.
I've replace my AsyncImages view with just single ProgressBar - the same. It doesn't spin.

Any suggestions?

UPD.

Spinner doen't spin cause of

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 (e.g., after an image has loaded), call showInfoWindow(). Furthermore, the info window will not respect any of the interactivity typical for a normal view such as touch or gesture events. However you can listen to a generic click event on the whole info window as described in the section below.

So the question is - how to realize AsyncImages from web/cache on Maps in the best way?
Create Views array somewhere apart of getContentInfo() method and also create listener smth like OnImageDownloaded?

2 Answers2

5

As stated at Google Maps Android API v2 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 (e.g., after an image has loaded), call showInfoWindow(). Furthermore, the info window will not respect any of the interactivity typical for a normal view such as touch or gesture events. However you can listen to a generic click event on the whole info window as described in the section below.

Perhaps you should try to call showInfoWindow() somewhere again in your code.

Spartako
  • 113
  • 2
  • 10
  • Thanks, i totally missed this small note. But the problem is still here. I guess than I should create Views to show in InfoWindow not in _getContentInfo()_ method but somewhere else ,and create another listener to notify me than image is downloaded and set into view. Looks quite annoying – Konstantin Kiriushyn Jan 15 '13 at 10:12
  • quite annoying indeed... but seems plausible, please post it if you manage to make it work! I'm working on something similar and this could be helpful – Spartako Jan 15 '13 at 12:04
0

I had the same problem here.

I think that calling showInfoWindows() for a spinning ( indeterminate ) progress bar doesn't make sense to me, and I'm also not sure it works. ( of course showinfoWindows may have sense for a horizontal progress bar) So I went for one of the following three solutions,

1) left the progress bar not animated beside a "Loading..." text, it gives an idea to the user at least. 2) put the loading spinning wheel somewhere else in the UI. 3) Using a dialog fragment to show loading procedure but it really depends on the feel you want to achieve with your app.

Personally I've chosen the first one.

I really hope that Google will fix this in future.

MadBlack
  • 327
  • 4
  • 15