Book Image

Learning Android Google Maps

Book Image

Learning Android Google Maps

Overview of this book

This book helps you to overcome the most common problems faced by users and helps you create a successful map application without any hassle. The book starts with a brief description of how to set up an environment and obtain an API key to create your map application. This book will teach you about adding markers, overlays, and information windows to the map in detail. You will then dive deep into customizing various types of maps and working with location data and Google Street view. By the end of this book, you will be able to create succinct map applications in Android using Google maps efficiently.
Table of Contents (18 chapters)
Learning Android Google Maps
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Expanding markers with information windows


Information windows are used to display additional information on a map, such as text and images. The information windows are supported by markers. Normally, information windows are displayed when a marker is tapped.

Note

You can display only one information window at a time. When another marker is clicked on, the current window is hidden and other windows pop up.

The following image is an example of an information window:

The information box that is displayed above the marker is the information window. The text that is displayed in bold is called a Title and the text that is displayed below the title is the called a Snippet.

How to add an information window?

An information window can be added by calling the title() and snippet() method on the MarkerOptions() object, which takes a string as an argument.

The following code makes this possible. We have predefined the LatLng values of a location, such as London, using this code:

    static final LatLng LONDON...