Configuring and Using Map Views

The MapView class displays the Google map; it includes several options for specifying how the map is

By default the Map View will show the standard street map, as shown in Figure 8-4. In addition, you can choose to display a satellite view, StreetView, and expected traffic, as shown in the following code snippet:

mapView.setSatellite(true); mapView.setStreetView(true); mapView.setTraffic(true);

You can also query the Map View to find the current and maximum available zoom levels, as well as the center point and currently visible longitude and latitude span (in decimal degrees). The latter (shown in the following snippet) is particularly useful for performing geographically limited Geocoder lookups:

int maxZoom = mapView.getMaxZoomLevel(); GeoPoint center = mapView.getMapCenter(); int latSpan = mapView.getLatitudeSpan(); int longSpan = mapView.getLongitudeSpan();

You can also optionally display the standard map zoom controls using the setBuiltlnZoomControls method.


Mobile Apps Made Easy

Mobile Apps Made Easy

Quick start guide to skyrocket your offline and online business success with mobile apps. If you know anything about mobile devices, you’ve probably heard that famous phrase coined by one of the mobile device’s most prolific creators proclaiming that there’s an app for pretty much everything.

Get My Free Training Guide

Post a comment