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

Moving the camera


The Google Maps API helps us to move from one visible region to another. This can be done by changing the camera view.

The camera view changing from one location to another can be animated. The duration of the animation can also be controlled.

To achieve this, we need to obtain the CameraUpdate object from the CameraUpdateFactory class.

The different ways to animate the camera views are as follows:

  • Changing zoom levels in the current position

  • Changing the camera position

  • Setting boundaries for the view

  • Panning the map

Changing the zoom level in the current position

Let's discuss the different methods used to change the zoom level. These methods should be called on the CameraUpdateFactory class to obtain the CameraUpdate object:

Method

Parameter

Function

zoomIn()

None

This increases the zoom level by 1. Other properties remain the same.

zoomOut()

None

This decreases the zoom level by 1. Other properties remain the same.

zoomTo()

Zoom level in float

This changes the zoom...