Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Is there a way to open the infowindow automatically when we add a marker? Using this code to add the marker but infowindow only opens when clicking the marker:

myMap.addMarker(new MarkerOptions()
            .position(latLng)
            .title("Title")
            .snippet("Snippet")
            .icon(BitmapDescriptorFactory
                    .fromResource(R.drawable.marker)));
question from:https://stackoverflow.com/questions/15899619/opening-infowindow-automatically-when-adding-marker-google-maps-v2-android

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
185 views
Welcome To Ask or Share your Answers For Others

1 Answer

According to the documents of Google Maps for Android V2:

An info window allows you to display information to the user when they tap on a marker on a map. By default, an info window is displayed when a user taps on a marker if the marker has a title set. Only one info window is displayed at a time. If a user clicks on another marker, the current window will be hidden and the new info window will be displayed. You can show an info window programmatically by calling showInfoWindow() on the target marker. An info window can be hidden by calling hideInfoWindow().

You can show the info window like this:

Marker marker = myMap.addMarker(new MarkerOptions()
                     .position(latLng)
                     .title("Title")
                     .snippet("Snippet")
                     .icon(BitmapDescriptorFactory
                     .fromResource(R.drawable.marker)));

marker.showInfoWindow();

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...