O'Reilly logo

Learning Android Google Maps by Raj Amal W.

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Implementing different types of maps

Make sure you have registered your application in the Google Developer Console and obtained the API key for it. Then, set up Google Play services and define the API Key in manifest. Now, let's see how to implement different types of maps in our application.

Create a new Android application in Eclipse or Android Studio. Let's see the code needed for a layout file. The easiest way to load a map is using a MapFragment class. The code for the layout is the same as the one we used in the previous chapter:

<?xml version="1.0" encoding="utf-8"?> <fragment xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" android:name="com.google.android.gms.maps.MapFragment"/> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required