Page 67

Android Programming Cookbook

59 / 143

package com.javacodegeeks.androidgooglemapsexample; public class CustomMarker { private String id; private Double latitude; private Double longitude; public CustomMarker(String id, Double latitude, Double longitude) { this.id = id; this.latitude = latitude; this.longitude = longitude; } public CustomMarker() { this.id = ""; this.latitude = 0.0; this.longitude = 0.0; } public String getCustomMarkerId() { return id; } public void setCustomMarkerId(String id) { this.id = id; } public Double getCustomMarkerLatitude() { return latitude; } public void setCustomMarkerLatitude(Double mLatitude) { this.latitude = mLatitude; } public Double getCustomMarkerLongitude() { return longitude; } public void setCustomMarkerLongitude(Double mLongitude) { this.longitude = mLongitude; } }

As you can see below, we have added an id attribute in our helper class, in order to have an identifier for our CustomMarker. This will help us find the right marker that we have created and change, or remove it separately. public void setCustomMarkerId(String id) { this.id = id; }

3.7

Creating the source code of the helper class LatLngInterpolator.java

Open src/com.javacodegeeks.androidgooglemapsexample/LatLngInterpolator.java file and paste the code below. LatLngInterpolator.java

SKY MAGZ  

This is Yahya Christian School Magazine