2

I'm adding a marker to my SupportMapFragment as shown. I would like for the title to be shown automatically, instead of requiring the user to tap on the marker. Is there a way?

    googleMap.addMarker(new MarkerOptions()
            .position(new LatLng(
                    Double.parseDouble(getArguments().getString("lat")),
                    Double.parseDouble(getArguments().getString("lng"))
            ))
            .title(getArguments().getString("name")));

    try {
        googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(
                new LatLng(
                        Double.parseDouble(getArguments().getString("lat")),
                        Double.parseDouble(getArguments().getString("lng")))
                , new Float(15.0)
        ));
    } catch (Exception e) {
        //ignore
    }
terencey
  • 3,282
  • 4
  • 32
  • 40
  • 1
    check this link it's very help full to you,http://stackoverflow.com/questions/15899619/opening-infowindow-automatically-when-adding-marker-google-maps-v2-android – Jignesh Jain May 13 '15 at 04:19

1 Answers1

5

Thanks to @JigneshJain,

Marker marker = googleMap.addMarker(new MarkerOptions()
            .position(new LatLng(
                    Double.parseDouble(getArguments().getString("lat")),
                    Double.parseDouble(getArguments().getString("lng"))
            ))
            .title(getArguments().getString("name")));
marker.showInfoWindow();
terencey
  • 3,282
  • 4
  • 32
  • 40