Show and Hide Info Window Automatically in Android with GMaps

Info window is a window that located on the top of marker in maps. When you add a marker to your map, the info window will not be shown by default. Sometimes you want to show it automatically when it is added to your map or you want to hide it for some reason. You can do it with this simple code.

Info Window Example

Info Window Example

MarkerOptions pin = new MarkerOptions();
pin.position(new LatLng(nearest.getLatitude(), nearest.getLongitude()));

// Save marker object in a variable								
Marker marker = map.addMarker(pin);
// Show info window
// Hide info window

That’s all. Remember that you can just show 1 info window at the same time. 😀

Nanda Firdaus

Ex-engineer who is switching to product management role in Traveloka. Passionate about new technology and have interest in product development, business, and investment. Ex-Microsoft Student Partner. Master of Information System Management at Carnegie Mellon University. Bachelor of Information System, Faculty of Computer Science, Universitas Indonesia.

2 Responses

  1. Anushka Agarwal says:

    Thanks a lot for this post..I was struggling from whole day….Ur post save me…:)

Leave a Reply

Your email address will not be published.