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

Creating a custom application

We are now going to create a custom map application. When we tap anywhere on a map, a dialog is shown, which takes text for Title and Snippet for a marker as input. The marker is placed on the clicked location along with an information window.

We can add as many markers as we need and remove a marker by tapping on the information window. Let's proceed!

Our activity layout code is the same as the one we've used before:

<?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" />

activity_maps.xml

Next, we need to create a custom ...

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