How to implement to show multiple titles on android googlemaps

When i was trying to display multiple titles(like hello1 and hello2 in code) on google map it shows last title(hello2) only.

Here is my code:

  mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
  mMap.addMarker(new MarkerOptions()
    .position(new LatLng(40.444310, -75.858923))
    .title("Hello1"))
    .showInfoWindow();

  mMap.addMarker(new MarkerOptions()
    .position(new LatLng(40.303626, -75.592905))
    .title("Hello2"))
    .showInfoWindow();

Upvotes: 1

Views: 953

Answers (2)

Simas
Simas

Reputation: 44118

As the other answer noted you can't display multiple info windows.

However there are some ways to overcome that. For example override OnMarkerClickListener and switch the marker's icon with the popups bitmap.

The popup can also be a view which when drawn can act as your bitmap for the replacement.

However you probably shouldn't meddle too much with google's initial design.

Here's a similar question with an answer that might help you. Good luck.

Upvotes: 1

rindress
rindress

Reputation: 706

You can only show one info window at a time.

"An info window allows you to display information to the user when they tap on a marker. Only one info window is displayed at a time. If a user clicks on another marker, the current info window will be hidden and the new info window will be displayed."

https://developers.google.com/maps/documentation/android/infowindows

Upvotes: 1

Related Questions