Hello, I finish the application on androyd where GoogleMap api v2 card is actively used. There is an array of objects (future markers) that are displayed on the map. The previous developer implemented the addition of markers to the map programmatically through for each, thus:

for (MarkerOptions marker : markers) ///markers-это ArrayList markers options { googleMap.addMarker(marker); //googleMap.addMarker(marker).showInfoWindow();////////////////////////////////raffa mod //googleMap.get builder.include(marker.getPosition()); } 

How do I implement the showInfoWindow () method on all the markers on the map without clicking on the markers?

  • Little did not understand what you want. That all markers at once, automatically showed? Or what? - rjhdby
  • Yes, in order not to click on the markers -coots over them got out, and automatically when you initialize the card - GoodRA
  • marker.performClick () appropriate? - Jarvis_J

2 answers 2

The fact is that you will not get to the marker this way, the object is not created explicitly, Marker marker is equal, etc., in my case, markers are added by type map.addmarker (markerOptions) through a for each loop, that’s the problem

    I do not know whether this option will suit you, but still. In your for each loop, after adding the marker, you can immediately call showInfoWindow (). Thus, for all markers that you put, informational windows will be included.

     for (MarkerOptions marker : markers) ///markers-это ArrayList markers options { googleMap.addMarker(marker).showInfoWindow(); } 

    Now I'm trying to deal with Google maps, there is a similar code, I tried to do this - everything works.

    • Thanks, I tried this option, falls in the exception - GoodRA
    • @GoodRA what is the exception? more? - H.Taras
    • Into an error, unfornatelly, not debugging and did not look at the logs simply - GoodRA