{"id":19893,"date":"2015-03-17T11:00:27","date_gmt":"2015-03-17T09:00:27","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=19893"},"modified":"2019-04-24T15:57:18","modified_gmt":"2019-04-24T12:57:18","slug":"android-google-maps-v2-tutorial","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/android\/core\/google-maps\/android-google-maps-v2-tutorial\/","title":{"rendered":"Android Google Maps v2 Tutorial"},"content":{"rendered":"<p>The great power of mobile applications software, is that it gives us the opportunity to develop many ideas that use hardware features, in order to complete simple everyday tasks. One idea that is implemented in a very good way in the mobile applications world, is the use of maps and the location based applications, that help us in multiple ways in our every day life. So, the use of maps is very important in various mobile applications.<\/p>\n<p>Google provides via Google Play Services a library for using maps. This library is the second attempt of Google Maps and this version provides significant improvements to the older API version. So, in this example, we are going to work with Google Maps v2 and see how we will import a fully working map Fragment in an Activity, as well as, we are going to work with basic Markers and CameraPosition on Google Map.<\/p>\n<p>For our example will use the following tools in a Windows 64-bit or an OS X platform:<\/p>\n<ul>\n<li>JDK 1.7<\/li>\n<li>Eclipse 4.2 Juno<\/li>\n<li>Android SDK 4.4.2<\/li>\n<\/ul>\n<p>Let\u2019s take a closer look:\n<\/p>\n<h2>1. Create a Google Maps API key<\/h2>\n<p>To begin with, we should create a new Google Maps API key and subscribe our application in order to grant access for our application to succesfully use Google Maps v2. In order to use this API, we will have to enter the Google API console portal. If you do not have an account, just create one or login with your current Google account.<\/p>\n<p><figure id=\"attachment_18361\" aria-describedby=\"caption-attachment-18361\" style=\"width: 700px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/01\/AndroidGooglePlusLoginExample-7.jpg\"><img decoding=\"async\" class=\"size-full wp-image-18361\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/01\/AndroidGooglePlusLoginExample-7.jpg\" alt=\"Figure 1. Enter Google API Console\" width=\"700\" height=\"373\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/01\/AndroidGooglePlusLoginExample-7.jpg 700w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/01\/AndroidGooglePlusLoginExample-7-300x160.jpg 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/a><figcaption id=\"caption-attachment-18361\" class=\"wp-caption-text\">Figure 1. Enter Google API Console<\/figcaption><\/figure><\/p>\n<p>After we enter the console, we are going to see the full list, of all the APIs that Google serves. Now we can see the enabled APIs that this console user has.<\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndroidGMapsAp-1.jpg\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-18362\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndroidGMapsApi-1.jpg\" alt=\"Figure 2. Go to APIs list\" width=\"800\" height=\"395\"><\/a><\/p>\n<p>After we enter the console,we are going to see the full list, of all the APIs that Google serves. The API that we are going to use, is the Google Maps v2 API. We click on the right service, and we turn it on. We have to accept the terms of Google Maps v2 API, by ticking the checkbox and by clicking the \u201cAccept\u201d button.<\/p>\n<p><figure id=\"attachment_18363\" aria-describedby=\"caption-attachment-18363\" style=\"width: 800px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndroidGMapsApi-2.jpg\"><img decoding=\"async\" class=\"size-full wp-image-18363\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndroidGMapsApi-2.jpg\" alt=\"Figure 3. Enable Google Maps v2 API\" width=\"800\" height=\"395\"><\/a><figcaption id=\"caption-attachment-18363\" class=\"wp-caption-text\">Figure 3. Enable Google Maps v2 API<\/figcaption><\/figure><\/p>\n<p>We should see the Google Maps v2 API enabled.<\/p>\n<p><figure id=\"attachment_18364\" aria-describedby=\"caption-attachment-18364\" style=\"width: 800px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndroidGMapsApi-3.jpg\"><img decoding=\"async\" class=\"size-full wp-image-18364\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndroidGMapsApi-3.jpg\" alt=\"Figure 4: Google Maps v2 API enabled\" width=\"800\" height=\"395\"><\/a><figcaption id=\"caption-attachment-18364\" class=\"wp-caption-text\">Figure 4: Google Maps v2 API enabled<\/figcaption><\/figure><\/p>\n<p>We are going to create a Public API access credential, in order to take the right response from the Google Places API search call. We only have to go to APIs&amp;auth &gt; Credentials tab.<\/p>\n<p><figure id=\"attachment_16274\" aria-describedby=\"caption-attachment-16274\" style=\"width: 780px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/11\/AndroidGooglePlacesExample-6.jpg\"><img decoding=\"async\" class=\"size-full wp-image-16274\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/11\/AndroidGooglePlacesExample-6.jpg\" alt=\"Figure 5. Credentials Key\" width=\"780\" height=\"416\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/11\/AndroidGooglePlacesExample-6.jpg 780w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/11\/AndroidGooglePlacesExample-6-300x160.jpg 300w\" sizes=\"(max-width: 780px) 100vw, 780px\" \/><\/a><figcaption id=\"caption-attachment-16274\" class=\"wp-caption-text\">Figure 5. Credentials Key<\/figcaption><\/figure><\/p>\n<p>We click the \u201cCreate new Key\u201d button, and select the \u201cAndroid Key\u201d in order to make a Key that will both work from our Android Application and from our browser. We are going to do this, exclusively for our example scope.<\/p>\n<div class=\"tip\">\n<p><strong>Tip<\/strong><\/p>\n<p>If you want to publish an application to the Google Play Store, that uses any of these Google API calls, you should create an Android key, by using the SHA-1 key of your original keystore (not the debug one) of the application to be exported.<\/p>\n<\/div>\n<p><figure id=\"attachment_16275\" aria-describedby=\"caption-attachment-16275\" style=\"width: 600px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/11\/AndroidGooglePlacesExample-7.jpg\"><img decoding=\"async\" class=\"size-full wp-image-16275\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/11\/AndroidGooglePlacesExample-7.jpg\" alt=\"Figure 6. Create new Key\" width=\"600\" height=\"320\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/11\/AndroidGooglePlacesExample-7.jpg 600w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/11\/AndroidGooglePlacesExample-7-300x160.jpg 300w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><\/a><figcaption id=\"caption-attachment-16275\" class=\"wp-caption-text\">Figure 6. Create new Key<\/figcaption><\/figure><\/p>\n<p>We are going to do this, exclusively for our application scope. So we have to provide our application\u2019s name and package. We have also to fill the SHA-1 cerificate fingerprint.<\/p>\n<p><figure id=\"attachment_16276\" aria-describedby=\"caption-attachment-16276\" style=\"width: 689px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndroidGMapsApi-4.jpg\"><img decoding=\"async\" class=\"size-full wp-image-16276\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndroidGMapsApi-4.jpg\" alt=\"Figure 7. Configure the allowed IPs\" width=\"689\" height=\"494\"><\/a><figcaption id=\"caption-attachment-16276\" class=\"wp-caption-text\">Figure 7. Configure the allowed IPs<\/figcaption><\/figure><\/p>\n<p>If you are not familiar on how to get your SHA-1 cerificate fingerprint, the easiest way to reach this certificate, is inside your Eclipse IDE, from Window &gt; Preferences &gt; Android &gt; Build.<\/p>\n<p><figure id=\"attachment_18368\" aria-describedby=\"caption-attachment-18368\" style=\"width: 600px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/01\/AndroidGooglePlusLoginExample-14.jpg\"><img decoding=\"async\" class=\"size-full wp-image-18368\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/01\/AndroidGooglePlusLoginExample-14.jpg\" alt=\"Figure 8. SHA-1 cerificate fingerprint on Eclipse\" width=\"600\" height=\"541\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/01\/AndroidGooglePlusLoginExample-14.jpg 600w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/01\/AndroidGooglePlusLoginExample-14-300x271.jpg 300w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><\/a><figcaption id=\"caption-attachment-18368\" class=\"wp-caption-text\">Figure 8. SHA-1 cerificate fingerprint on Eclipse<\/figcaption><\/figure><\/p>\n<h2>2. Create a New Android Application Project<\/h2>\n<div class=\"tip\">\n<p><strong>Tip<\/strong><\/p>\n<p>You may skip project creation and jump directly to the <a href=\"#code\"><strong>beginning of the example<\/strong><\/a> below.<\/p>\n<\/div>\n<p>Open Eclipse IDE and go to File \u2192 New \u2192 Project \u2192 Android Application Project.<\/p>\n<p><figure id=\"attachment_13637\" aria-describedby=\"caption-attachment-13637\" style=\"width: 525px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndroidExampleA-1.jpg\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-20696\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndroidExampleA-1.jpg\" alt=\"Figure 9. Create a new Android project\" width=\"525\" height=\"500\"><\/a><figcaption id=\"caption-attachment-13637\" class=\"wp-caption-text\">Figure 9. Create a new Android project<\/figcaption><\/figure><\/p>\n<p>Specify the name of the application, the project and the package and then click Next.<\/p>\n<p><figure id=\"attachment_13637\" aria-describedby=\"caption-attachment-13637\" style=\"width: 636px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndoidGoogleMapsExample-1.jpg\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-20696\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndoidGoogleMapsExample-1.jpg\" alt=\"Figure 10. Create a new Android project name\" width=\"636\" height=\"545\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndoidGoogleMapsExample-1.jpg 636w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndoidGoogleMapsExample-1-300x257.jpg 300w\" sizes=\"(max-width: 636px) 100vw, 636px\" \/><\/a><figcaption id=\"caption-attachment-13637\" class=\"wp-caption-text\">Figure 10. Create a new Android project name<\/figcaption><\/figure><\/p>\n<p>In the next window, the \u201cCreate Activity\u201d option should be checked. The new created activity will be the main activity of your project. Then press Next button.<\/p>\n<p><figure id=\"attachment_20697\" aria-describedby=\"caption-attachment-20697\" style=\"width: 636px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndoidGoogleMapsExample-2.jpg\"><img decoding=\"async\" class=\"size-full wp-image-20697\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndoidGoogleMapsExample-2.jpg\" alt=\"Figure 11. Configure the project\" width=\"636\" height=\"545\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndoidGoogleMapsExample-2.jpg 636w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndoidGoogleMapsExample-2-300x257.jpg 300w\" sizes=\"(max-width: 636px) 100vw, 636px\" \/><\/a><figcaption id=\"caption-attachment-20697\" class=\"wp-caption-text\">Figure 11. Configure the project<\/figcaption><\/figure><\/p>\n<p>In \u201cConfigure Launcher Icon\u201d window you should choose the icon you want to have in your app. We will use the default icon of android, so click Next.<\/p>\n<p><figure id=\"attachment_20699\" aria-describedby=\"caption-attachment-20699\" style=\"width: 611px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndroidExampleB-1.jpg\"><img decoding=\"async\" class=\"size-full wp-image-20699\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndroidExampleB-1.jpg\" alt=\"Figure 12. Configure the launcher icon\" width=\"611\" height=\"570\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndroidExampleB-1.jpg 611w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndroidExampleB-1-300x280.jpg 300w\" sizes=\"(max-width: 611px) 100vw, 611px\" \/><\/a><figcaption id=\"caption-attachment-20699\" class=\"wp-caption-text\">Figure 12. Configure the launcher icon<\/figcaption><\/figure><\/p>\n<p>Select the \u201cBlank Activity\u201d option and press Next.<\/p>\n<p><figure id=\"attachment_20700\" aria-describedby=\"caption-attachment-20700\" style=\"width: 611px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndroidExampleB-2.jpg\"><img decoding=\"async\" class=\"size-full wp-image-20700\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndroidExampleB-2.jpg\" alt=\"Figure 13. Create the activity and select its type\" width=\"611\" height=\"570\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndroidExampleB-2.jpg 611w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndroidExampleB-2-300x280.jpg 300w\" sizes=\"(max-width: 611px) 100vw, 611px\" \/><\/a><figcaption id=\"caption-attachment-20700\" class=\"wp-caption-text\">Figure 13. Create the activity and select its type<\/figcaption><\/figure><\/p>\n<p>You have to specify a name for the new Activity and a name for the layout description of your app. The .xml file for the layout will automatically be created in the res\/layout folder. It will also be created a fragment layout xml, that we are not going to use in this project and you can remove it if you want. Then press Finish.<\/p>\n<p><figure id=\"attachment_20698\" aria-describedby=\"caption-attachment-20698\" style=\"width: 596px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndoidGoogleMapsExample-3.jpg\"><img decoding=\"async\" class=\"size-full wp-image-20698\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndoidGoogleMapsExample-3.jpg\" alt=\"Figure 14. Create a new blank activity\" width=\"596\" height=\"514\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndoidGoogleMapsExample-3.jpg 596w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndoidGoogleMapsExample-3-300x259.jpg 300w\" sizes=\"(max-width: 596px) 100vw, 596px\" \/><\/a><figcaption id=\"caption-attachment-20698\" class=\"wp-caption-text\">Figure 14. Create a new blank activity<\/figcaption><\/figure><\/p>\n<p>Here you can see, how will the structure of the project become when finished:<\/p>\n<p><figure id=\"attachment_13789\" aria-describedby=\"caption-attachment-13789\" style=\"width: 346px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/AndroidQrCodeExample-4.jpg\"><img decoding=\"async\" class=\"size-full wp-image-13789\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndroidGoogleMapsExample-project.jpg\" alt=\"Figure 15. The tree of the project\" width=\"346\" height=\"504\"><\/a><figcaption id=\"caption-attachment-13789\" class=\"wp-caption-text\">Figure 15. The tree of the project<\/figcaption><\/figure><\/p>\n<p>&nbsp;<\/p>\n<h2>3. Importing Google Play Services in your project<\/h2>\n<p>In order to be able to work with Google Maps v2, we have to import the Google Play Services library in the project.<\/p>\n<div class=\"tip\">\n<p><strong>Tip<\/strong><\/p>\n<p>Google Maps v2 will work only on devices that do have Google Play Services. If your mobile device does not have Google Play Services you have to download and use the Google Play Services application from Google Play.<\/p>\n<\/div>\n<p>Download Google Play Services SDK. We have to launch Android SDK Manager and install the Google Play services package.<\/p>\n<p><figure id=\"attachment_17609\" aria-describedby=\"caption-attachment-17609\" style=\"width: 800px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-5.jpg\"><img decoding=\"async\" class=\"size-full wp-image-17609\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-5.jpg\" alt=\"Figure 16. Launch Android SDK Manager\" width=\"800\" height=\"426\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-5.jpg 800w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-5-300x159.jpg 300w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/a><figcaption id=\"caption-attachment-17609\" class=\"wp-caption-text\">Figure 16. Launch Android SDK Manager<\/figcaption><\/figure><br \/>\n<figure id=\"attachment_17610\" aria-describedby=\"caption-attachment-17610\" style=\"width: 740px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-6.jpg\"><img decoding=\"async\" class=\"size-full wp-image-17610\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-6.jpg\" alt=\"Figure 17. Download Google Play Services library\" width=\"740\" height=\"470\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-6.jpg 740w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-6-300x190.jpg 300w\" sizes=\"(max-width: 740px) 100vw, 740px\" \/><\/a><figcaption id=\"caption-attachment-17610\" class=\"wp-caption-text\">Figure 17. Download Google Play Services library<\/figcaption><\/figure><br \/>\n<figure id=\"attachment_17611\" aria-describedby=\"caption-attachment-17611\" style=\"width: 525px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-7.jpg\"><img decoding=\"async\" class=\"size-full wp-image-17611\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-7.jpg\" alt=\"Figure 18. Import the library as an existing Android project\" width=\"525\" height=\"550\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-7.jpg 525w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-7-286x300.jpg 286w\" sizes=\"(max-width: 525px) 100vw, 525px\" \/><\/a><figcaption id=\"caption-attachment-17611\" class=\"wp-caption-text\">Figure 18. Import the library as an existing Android project<\/figcaption><\/figure><br \/>\n<figure id=\"attachment_17612\" aria-describedby=\"caption-attachment-17612\" style=\"width: 646px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-8.jpg\"><img decoding=\"async\" class=\"size-full wp-image-17612\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-8.jpg\" alt=\"Figure 19. Import the library as an existing Android project\" width=\"646\" height=\"728\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-8.jpg 646w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-8-266x300.jpg 266w\" sizes=\"(max-width: 646px) 100vw, 646px\" \/><\/a><figcaption id=\"caption-attachment-17612\" class=\"wp-caption-text\">Figure 19. Import the library as an existing Android project<\/figcaption><\/figure><div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-9.jpg\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-17618\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-9.jpg\" alt=\"Figure 20. Import completed.\" height=\"728\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-9.jpg 801w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-9-300x272.jpg 300w\" sizes=\"(max-width: 801px) 100vw, 801px\" \/><\/a><\/p>\n<p>After downloading the Google Play Service package, just import this project into the main Android Google Maps v2 project.<\/p>\n<p>&nbsp;<\/p>\n<h2>3. Create the layout of the main Google Maps v2<\/h2>\n<p>We are going to make a simple layout xml for the <code>AndroidGoogleMapsExample.java<\/code>, that consists of a parent <code>RelativeLayout<\/code> and a child <code>LinearLayout<\/code> with vertical orientation, that includes a <code>Google Map Fragment<\/code> and a horizontal <code>LinearLayout<\/code> that includes 3 <code>Buttons<\/code> that lister to the corresponding actions.<\/p>\n<p>Open <code>res\/layout\/activity_main.xml<\/code>, go to the respective xml tab and paste the following:<\/p>\n<p><em><span style=\"text-decoration: underline;\">activity_main.xml<\/span><\/em><\/p>\n<pre class=\"brush:xml; wrap-lines:false;\">&lt;RelativeLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\n    xmlns:tools=\"http:\/\/schemas.android.com\/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    tools:context=\"com.javacodegeeks.androidgooglemapsexample.AndroidGoogleMapsActivity\" &gt;\n\n    &lt;LinearLayout\n        android:layout_width=\"fill_parent\"\n        android:layout_height=\"fill_parent\"\n        android:orientation=\"vertical\" &gt;\n\n        &lt;fragment\n            android:id=\"@+id\/mapFragment\"\n            android:layout_width=\"fill_parent\"\n            android:layout_height=\"0dp\"\n            android:layout_weight=\"1\"\n            class=\"com.google.android.gms.maps.SupportMapFragment\" \/&gt;\n\n        &lt;LinearLayout\n            android:layout_width=\"fill_parent\"\n            android:layout_height=\"wrap_content\"\n            android:gravity=\"center\"\n            android:orientation=\"horizontal\" &gt;\n\n            &lt;Button\n                android:id=\"@+id\/button1\"\n                android:layout_width=\"0dp\"\n                android:layout_height=\"fill_parent\"\n                android:layout_weight=\"1\"\n                android:onClick=\"startAnimation\"\n                android:text=\"Animate Marker\" \/&gt;\n\n            &lt;Button\n                android:id=\"@+id\/button2\"\n                android:layout_width=\"0dp\"\n                android:layout_height=\"fill_parent\"\n                android:layout_weight=\"1\"\n                android:onClick=\"zoomToMarkers\"\n                android:text=\"Zoom to markers\" \/&gt;\n\n            &lt;Button\n                android:id=\"@+id\/button3\"\n                android:layout_width=\"0dp\"\n                android:layout_height=\"fill_parent\"\n                android:layout_weight=\"1\"\n                android:onClick=\"animateBack\"\n                android:text=\"Animate back to position\" \/&gt;\n        &lt;\/LinearLayout&gt;\n    &lt;\/LinearLayout&gt;\n\n&lt;\/RelativeLayout&gt;\n<\/pre>\n<h2>4. Create the source code of the main AndroidGoogleMapsActivity<\/h2>\n<p>Open <code>src\/com.javacodegeeks.androidgooglemapsexample\/AndroidGoogleMapsActivity.java<\/code> file and paste the code below.<\/p>\n<p><em><span style=\"text-decoration: underline;\">AndroidGoogleMapsActivity.java<\/span><\/em><\/p>\n<pre class=\"brush:java; wrap-lines:false\">package com.javacodegeeks.androidgooglemapsexample;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.Iterator;\nimport java.util.Map;\nimport java.util.Map.Entry;\n\nimport android.os.Bundle;\nimport android.support.v4.app.FragmentActivity;\nimport android.view.View;\nimport android.widget.Toast;\n\nimport com.google.android.gms.maps.CameraUpdate;\nimport com.google.android.gms.maps.CameraUpdateFactory;\nimport com.google.android.gms.maps.GoogleMap;\nimport com.google.android.gms.maps.SupportMapFragment;\nimport com.google.android.gms.maps.model.BitmapDescriptorFactory;\nimport com.google.android.gms.maps.model.LatLng;\nimport com.google.android.gms.maps.model.LatLngBounds;\nimport com.google.android.gms.maps.model.Marker;\nimport com.google.android.gms.maps.model.MarkerOptions;\nimport com.javacodegeeks.androidgooglemapsexample.LatLngInterpolator.LinearFixed;\n\npublic class AndroidGoogleMapsActivity extends FragmentActivity {\n\n\t\/\/ Google Map\n\tprivate GoogleMap googleMap;\n\tprivate HashMap markersHashMap;\n\tprivate Iterator&lt;Entry&gt; iter;\n\tprivate CameraUpdate cu;\n\tprivate CustomMarker customMarkerOne, customMarkerTwo;\n\n\t@Override\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\tsetContentView(R.layout.activity_main);\n\n\t\ttry {\n\t\t\t\/\/ Loading map\n\t\t\tinitilizeMap();\n\t\t\tinitializeUiSettings();\n\t\t\tinitializeMapLocationSettings();\n\t\t\tinitializeMapTraffic();\n\t\t\tinitializeMapType();\n\t\t\tinitializeMapViewSettings();\n\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}\n\n\t@Override\n\tprotected void onResume() {\n\t\tsuper.onResume();\n\t\t\/\/ initilizeMap();\n\t}\n\n\tprivate void initilizeMap() {\n\n\t\tgoogleMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.mapFragment)).getMap();\n\n\t\t\/\/ check if map is created successfully or not\n\t\tif (googleMap == null) {\n\t\t\tToast.makeText(getApplicationContext(), \"Sorry! unable to create maps\", Toast.LENGTH_SHORT).show();\n\t\t}\n\n\t\t(findViewById(R.id.mapFragment)).getViewTreeObserver().addOnGlobalLayoutListener(\n\t\t\t\tnew android.view.ViewTreeObserver.OnGlobalLayoutListener() {\n\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void onGlobalLayout() {\n\t\t\t\t\t\tif (android.os.Build.VERSION.SDK_INT &gt;= 16) {\n\t\t\t\t\t\t\t(findViewById(R.id.mapFragment)).getViewTreeObserver().removeOnGlobalLayoutListener(this);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t(findViewById(R.id.mapFragment)).getViewTreeObserver().removeGlobalOnLayoutListener(this);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetCustomMarkerOnePosition();\n\t\t\t\t\t\tsetCustomMarkerTwoPosition();\n\t\t\t\t\t}\n\t\t\t\t});\n\t}\n\n\tvoid setCustomMarkerOnePosition() {\n\t\tcustomMarkerOne = new CustomMarker(\"markerOne\", 40.7102747, -73.9945297);\n\t\taddMarker(customMarkerOne);\n\t}\n\n\tvoid setCustomMarkerTwoPosition() {\n\t\tcustomMarkerTwo = new CustomMarker(\"markerTwo\", 43.7297251, -74.0675716);\n\t\taddMarker(customMarkerTwo);\n\t}\n\n\tpublic void startAnimation(View v) {\n\t\tanimateMarker(customMarkerOne, new LatLng(40.0675716, 40.7297251));\n\t}\n\n\tpublic void zoomToMarkers(View v) {\n\t\tzoomAnimateLevelToFitMarkers(120);\n\t}\n\n\tpublic void animateBack(View v) {\n\t\tanimateMarker(customMarkerOne, new LatLng(32.0675716, 27.7297251));\n\t}\n\n\tpublic void initializeUiSettings() {\n\t\tgoogleMap.getUiSettings().setCompassEnabled(true);\n\t\tgoogleMap.getUiSettings().setRotateGesturesEnabled(false);\n\t\tgoogleMap.getUiSettings().setTiltGesturesEnabled(true);\n\t\tgoogleMap.getUiSettings().setZoomControlsEnabled(true);\n\t\tgoogleMap.getUiSettings().setMyLocationButtonEnabled(true);\n\t}\n\n\tpublic void initializeMapLocationSettings() {\n\t\tgoogleMap.setMyLocationEnabled(true);\n\t}\n\n\tpublic void initializeMapTraffic() {\n\t\tgoogleMap.setTrafficEnabled(true);\n\t}\n\n\tpublic void initializeMapType() {\n\t\tgoogleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);\n\t}\n\n\t\n\tpublic void initializeMapViewSettings() {\n\t\tgoogleMap.setIndoorEnabled(true);\n\t\tgoogleMap.setBuildingsEnabled(false);\n\t}\n\t\n\n\t\/\/this is method to help us set up a Marker that stores the Markers we want to plot on the map\n\tpublic void setUpMarkersHashMap() {\n\t\tif (markersHashMap == null) {\n\t\t\tmarkersHashMap = new HashMap();\n\t\t}\n\t}\n\t\n\t\/\/this is method to help us add a Marker into the hashmap that stores the Markers\n\tpublic void addMarkerToHashMap(CustomMarker customMarker, Marker marker) {\n\t\tsetUpMarkersHashMap();\n\t\tmarkersHashMap.put(customMarker, marker);\n\t}\n\n\t\/\/this is method to help us find a Marker that is stored into the hashmap\n\tpublic Marker findMarker(CustomMarker customMarker) {\n\t\titer = markersHashMap.entrySet().iterator();\n\t\twhile (iter.hasNext()) {\n\t\t\tMap.Entry mEntry = (Map.Entry) iter.next();\n\t\t\tCustomMarker key = (CustomMarker) mEntry.getKey();\n\t\t\tif (customMarker.getCustomMarkerId().equals(key.getCustomMarkerId())) {\n\t\t\t\tMarker value = (Marker) mEntry.getValue();\n\t\t\t\treturn value;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\n\t\/\/this is method to help us add a Marker to the map\n\tpublic void addMarker(CustomMarker customMarker) {\n\t\tMarkerOptions markerOption = new MarkerOptions().position(\n\t\t\t\tnew LatLng(customMarker.getCustomMarkerLatitude(), customMarker.getCustomMarkerLongitude())).icon(\n\t\t\t\tBitmapDescriptorFactory.defaultMarker());\n\n\t\tMarker newMark = googleMap.addMarker(markerOption);\n\t\taddMarkerToHashMap(customMarker, newMark);\n\t}\n\t\n\t\/\/this is method to help us remove a Marker\n\tpublic void removeMarker(CustomMarker customMarker) {\n\t\tif (markersHashMap != null) {\n\t\t\tif (findMarker(customMarker) != null) {\n\t\t\t\tfindMarker(customMarker).remove();\n\t\t\t\tmarkersHashMap.remove(customMarker);\n\t\t\t}\n\t\t}\n\t}\n\n\t\/\/this is method to help us fit the Markers into specific bounds for camera position\n\tpublic void zoomAnimateLevelToFitMarkers(int padding) {\n\t\tLatLngBounds.Builder b = new LatLngBounds.Builder();\n\t\titer = markersHashMap.entrySet().iterator();\n\n\t\twhile (iter.hasNext()) {\n\t\t\tMap.Entry mEntry = (Map.Entry) iter.next();\n\t\t\tCustomMarker key = (CustomMarker) mEntry.getKey();\n\t\t\tLatLng ll = new LatLng(key.getCustomMarkerLatitude(), key.getCustomMarkerLongitude());\n\t\t\tb.include(ll);\n\t\t}\n\t\tLatLngBounds bounds = b.build();\n\n\t\t\/\/ Change the padding as per needed\n\t\tcu = CameraUpdateFactory.newLatLngBounds(bounds, padding);\n\t\tgoogleMap.animateCamera(cu);\n\t}\n\n\t\/\/this is method to help us move a Marker.\n\tpublic void moveMarker(CustomMarker customMarker, LatLng latlng) {\n\t\tif (findMarker(customMarker) != null) {\n\t\t\tfindMarker(customMarker).setPosition(latlng);\n\t\t\tcustomMarker.setCustomMarkerLatitude(latlng.latitude);\n\t\t\tcustomMarker.setCustomMarkerLongitude(latlng.longitude);\n\t\t}\n\t}\n\n\t\/\/this is method to animate the Marker. There are flavours for all Android versions\n\tpublic void animateMarker(CustomMarker customMarker, LatLng latlng) {\n\t\tif (findMarker(customMarker) != null) {\n\n\t\t\tLatLngInterpolator latlonInter = new LinearFixed();\n\t\t\tlatlonInter.interpolate(20,\n\t\t\t\t\tnew LatLng(customMarker.getCustomMarkerLatitude(), customMarker.getCustomMarkerLongitude()), latlng);\n\n\t\t\tcustomMarker.setCustomMarkerLatitude(latlng.latitude);\n\t\t\tcustomMarker.setCustomMarkerLongitude(latlng.longitude);\n\n\t\t\tif (android.os.Build.VERSION.SDK_INT &gt;= 14) {\n\t\t\t\tMarkerAnimation.animateMarkerToICS(findMarker(customMarker), new LatLng(customMarker.getCustomMarkerLatitude(),\n\t\t\t\t\t\tcustomMarker.getCustomMarkerLongitude()), latlonInter);\n\t\t\t} else if (android.os.Build.VERSION.SDK_INT &gt;= 11) {\n\t\t\t\tMarkerAnimation.animateMarkerToHC(findMarker(customMarker), new LatLng(customMarker.getCustomMarkerLatitude(),\n\t\t\t\t\t\tcustomMarker.getCustomMarkerLongitude()), latlonInter);\n\t\t\t} else {\n\t\t\t\tMarkerAnimation.animateMarkerToGB(findMarker(customMarker), new LatLng(customMarker.getCustomMarkerLatitude(),\n\t\t\t\t\t\tcustomMarker.getCustomMarkerLongitude()), latlonInter);\n\t\t\t}\n\t\t}\n\t}\n\n}\n<\/pre>\n<p>Let&#8217;s take a closer look:<\/p>\n<pre class=\"brush:java; wrap-lines:false\">\tprivate void initilizeMap() {\n\n\t\tgoogleMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.mapFragment)).getMap();\n\n\t\tif (googleMap == null) {\n\t\t\tToast.makeText(getApplicationContext(), \"Sorry! unable to create maps\", Toast.LENGTH_SHORT).show();\n\t\t}\n\n\t\t(findViewById(R.id.mapFragment)).getViewTreeObserver().addOnGlobalLayoutListener(\n\t\t\t\tnew android.view.ViewTreeObserver.OnGlobalLayoutListener() {\n\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void onGlobalLayout() {\n\t\t\t\t\t\t\/\/ gets called after layout has been done but before display\n\t\t\t\t\t\t\/\/ so we can get the height then hide the view\n\t\t\t\t\t\tif (android.os.Build.VERSION.SDK_INT &gt;= 16) {\n\t\t\t\t\t\t\t(findViewById(R.id.mapFragment)).getViewTreeObserver().removeOnGlobalLayoutListener(this);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t(findViewById(R.id.mapFragment)).getViewTreeObserver().removeGlobalOnLayoutListener(this);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetCustomMarkerOnePosition();\n\t\t\t\t\t\tsetCustomMarkerTwoPosition();\n\t\t\t\t\t\t\/\/ plotMarkers(markerList);\n\t\t\t\t\t}\n\t\t\t\t});\n\t}\n<\/pre>\n<p>With this method <code>initilizeMap()<\/code>, we set up our map in the <code>Fragment<\/code>. We use <code>SupportMapFragment<\/code> in order to make our map compatible with versions older than the Android version 4.0. Also by using the <code>OnGlobalLayoutListener<\/code> that is called after layout has been done, but before display, in order to avoid making any changes to the map, before the map is fully set up in our layout. Otherwise an error that says, that map is not ready yet, may appear.[ulp id=&#8217;Ja8Orb5oPKdShcXt&#8217;]<\/p>\n<pre class=\"brush:java; wrap-lines:false\">\tpublic void initializeUiSettings() {\n\t\tgoogleMap.getUiSettings().setCompassEnabled(true);\n\t\tgoogleMap.getUiSettings().setRotateGesturesEnabled(false);\n\t\tgoogleMap.getUiSettings().setTiltGesturesEnabled(true);\n\t\tgoogleMap.getUiSettings().setZoomControlsEnabled(true);\n\t\tgoogleMap.getUiSettings().setMyLocationButtonEnabled(true);\n\t}\n<\/pre>\n<p>With the method above, we initialize the map Ui settings, we set the compass, the gestures, the tilt gestures, the zoom controls and the button that centers us to our location spot.<\/p>\n<pre class=\"brush:java; wrap-lines:false\">\tpublic void initializeMapLocationSettings() {\n\t\tgoogleMap.setMyLocationEnabled(true);\n\t}\n<\/pre>\n<p>With the method above, we enable the blue location spot, that shows our position on the map.<\/p>\n<pre class=\"brush:java; wrap-lines:false\">\tpublic void initializeMapTraffic() {\n\t\tgoogleMap.setTrafficEnabled(true);\n\t}\n<\/pre>\n<p>With the method above, we enable the traffic lines layer on the map.<\/p>\n<pre class=\"brush:java; wrap-lines:false\">\tpublic void initializeMapType() {\n\t\tgoogleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);\n\t}\n<\/pre>\n<p>With the method above, we set the Map Type to the <code>GoogleMap.MAP_TYPE_NORMAL<\/code>.<\/p>\n<pre class=\"brush:java; wrap-lines:false\">\t\n\tpublic void initializeMapViewSettings() {\n\t\tgoogleMap.setIndoorEnabled(true);\n\t\tgoogleMap.setBuildingsEnabled(false);\n\t}\n<\/pre>\n<p>With the method above, we initialize the Map View settings, meaning the basic view map and buildings settings.<\/p>\n<pre class=\"brush:java; wrap-lines:false\">\tpublic void zoomAnimateLevelToFitMarkers(int padding) {\n\t\tLatLngBounds.Builder b = new LatLngBounds.Builder();\n\t\titer = markersHashMap.entrySet().iterator();\n\n\t\twhile (iter.hasNext()) {\n\t\t\tMap.Entry mEntry = (Map.Entry) iter.next();\n\t\t\tCustomMarker key = (CustomMarker) mEntry.getKey();\n\t\t\tLatLng ll = new LatLng(key.getCustomMarkerLatitude(), key.getCustomMarkerLongitude());\n\t\t\tb.include(ll);\n\t\t}\n\t\tLatLngBounds bounds = b.build();\n\n\t\t\/\/ Change the padding as per needed\n\t\tcu = CameraUpdateFactory.newLatLngBounds(bounds, padding);\n\t\tgoogleMap.animateCamera(cu);\n\t}\n<\/pre>\n<p>With the above method, we want to zoom the map, at a zoom that we will be able to view every marker that we added on the map. So, this is method to help us fit an array of Markers into specific bounds for camera position.<\/p>\n<h2>5. Creating the source code of the helper class CustomMarker.java<\/h2>\n<p>We are going to create the <code>CustomMarker.java<\/code> in order to help us make multiple markers and store them in an array, so that we can use them in the <code>AndroidGoogleMapsActivity<\/code>. This is a helper class.<\/p>\n<p>Open <code>src\/com.javacodegeeks.androidgooglemapsexample\/CustomMarker.java<\/code> file and paste the code below.<\/p>\n<p><em><span style=\"text-decoration: underline;\">CustomMarker.java<\/span><\/em><\/p>\n<pre class=\"brush:java; wrap-lines:false\">package com.javacodegeeks.androidgooglemapsexample;\n\npublic class CustomMarker {\n\n\tprivate String id;\n\tprivate Double latitude;\n\tprivate Double longitude;\n\n\tpublic CustomMarker(String id, Double latitude, Double longitude) {\n\n\t\tthis.id = id;\n\t\tthis.latitude = latitude;\n\t\tthis.longitude = longitude;\n\t}\n\n\tpublic CustomMarker() {\n\t\tthis.id = \"\";\n\t\tthis.latitude = 0.0;\n\t\tthis.longitude = 0.0;\n\t}\n\n\tpublic String getCustomMarkerId() {\n\t\treturn id;\n\t}\n\n\tpublic void setCustomMarkerId(String id) {\n\t\tthis.id = id;\n\t}\n\n\tpublic Double getCustomMarkerLatitude() {\n\t\treturn latitude;\n\t}\n\n\tpublic void setCustomMarkerLatitude(Double mLatitude) {\n\t\tthis.latitude = mLatitude;\n\t}\n\n\tpublic Double getCustomMarkerLongitude() {\n\t\treturn longitude;\n\t}\n\n\tpublic void setCustomMarkerLongitude(Double mLongitude) {\n\t\tthis.longitude = mLongitude;\n\t}\n}\n<\/pre>\n<p>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.<\/p>\n<pre class=\"brush:java; wrap-lines:false\">\tpublic void setCustomMarkerId(String id) {\n\t\tthis.id = id;\n\t}\n<\/pre>\n<h2>6. Creating the source code of the helper class LatLngInterpolator.java<\/h2>\n<p>Open <code>src\/com.javacodegeeks.androidgooglemapsexample\/LatLngInterpolator.java<\/code> file and paste the code below.<\/p>\n<p><em><span style=\"text-decoration: underline;\">LatLngInterpolator.java<\/span><\/em><\/p>\n<pre class=\"brush:java; wrap-lines:false\">package com.javacodegeeks.androidgooglemapsexample;\n\nimport static java.lang.Math.asin;\nimport static java.lang.Math.atan2;\nimport static java.lang.Math.cos;\nimport static java.lang.Math.pow;\nimport static java.lang.Math.sin;\nimport static java.lang.Math.sqrt;\nimport static java.lang.Math.toDegrees;\nimport static java.lang.Math.toRadians;\n\nimport com.google.android.gms.maps.model.LatLng;\n\npublic interface LatLngInterpolator {\n\tpublic LatLng interpolate(float fraction, LatLng a, LatLng b);\n\n\tpublic class Linear implements LatLngInterpolator {\n\t\t@Override\n\t\tpublic LatLng interpolate(float fraction, LatLng a, LatLng b) {\n\t\t\tdouble lat = (b.latitude - a.latitude) * fraction + a.latitude;\n\t\t\tdouble lng = (b.longitude - a.longitude) * fraction + a.longitude;\n\t\t\treturn new LatLng(lat, lng);\n\t\t}\n\t}\n\n\tpublic class LinearFixed implements LatLngInterpolator {\n\t\t@Override\n\t\tpublic LatLng interpolate(float fraction, LatLng a, LatLng b) {\n\t\t\tdouble lat = (b.latitude - a.latitude) * fraction + a.latitude;\n\t\t\tdouble lngDelta = b.longitude - a.longitude;\n\n\t\t\tif (Math.abs(lngDelta) &gt; 180) {\n\t\t\t\tlngDelta -= Math.signum(lngDelta) * 360;\n\t\t\t}\n\t\t\tdouble lng = lngDelta * fraction + a.longitude;\n\t\t\treturn new LatLng(lat, lng);\n\t\t}\n\t}\n\n\tpublic class Spherical implements LatLngInterpolator {\n\n\t\t@Override\n\t\tpublic LatLng interpolate(float fraction, LatLng from, LatLng to) {\n\n\t\t\tdouble fromLat = toRadians(from.latitude);\n\t\t\tdouble fromLng = toRadians(from.longitude);\n\t\t\tdouble toLat = toRadians(to.latitude);\n\t\t\tdouble toLng = toRadians(to.longitude);\n\t\t\tdouble cosFromLat = cos(fromLat);\n\t\t\tdouble cosToLat = cos(toLat);\n\n\t\t\tdouble angle = computeAngleBetween(fromLat, fromLng, toLat, toLng);\n\t\t\tdouble sinAngle = sin(angle);\n\t\t\tif (sinAngle &lt; 1E-6) {\n\t\t\t\treturn from;\n\t\t\t}\n\t\t\tdouble a = sin((1 - fraction) * angle) \/ sinAngle;\n\t\t\tdouble b = sin(fraction * angle) \/ sinAngle;\n\n\t\t\tdouble x = a * cosFromLat * cos(fromLng) + b * cosToLat * cos(toLng);\n\t\t\tdouble y = a * cosFromLat * sin(fromLng) + b * cosToLat * sin(toLng);\n\t\t\tdouble z = a * sin(fromLat) + b * sin(toLat);\n\n\t\t\tdouble lat = atan2(z, sqrt(x * x + y * y));\n\t\t\tdouble lng = atan2(y, x);\n\t\t\treturn new LatLng(toDegrees(lat), toDegrees(lng));\n\t\t}\n\n\t\tprivate double computeAngleBetween(double fromLat, double fromLng, double toLat, double toLng) {\n\n\t\t\tdouble dLat = fromLat - toLat;\n\t\t\tdouble dLng = fromLng - toLng;\n\t\t\treturn 2 * asin(sqrt(pow(sin(dLat \/ 2), 2) + cos(fromLat) * cos(toLat) * pow(sin(dLng \/ 2), 2)));\n\t\t}\n\t}\n}\n<\/pre>\n<h2>7. Creating the source code of the helper class MarkerAnimation.java<\/h2>\n<p>Open <code>src\/com.javacodegeeks.androidgooglemapsexample\/MarkerAnimation.java<\/code> file and paste the code below.<\/p>\n<p><em><span style=\"text-decoration: underline;\">MarkerAnimation.java<\/span><\/em><\/p>\n<pre class=\"brush:java; wrap-lines:false\">package com.javacodegeeks.androidgooglemapsexample;\n\nimport android.animation.ObjectAnimator;\nimport android.animation.TypeEvaluator;\nimport android.animation.ValueAnimator;\nimport android.annotation.TargetApi;\nimport android.os.Build;\nimport android.os.Handler;\nimport android.os.SystemClock;\nimport android.util.Property;\nimport android.view.animation.AccelerateDecelerateInterpolator;\nimport android.view.animation.Interpolator;\n\nimport com.google.android.gms.maps.model.LatLng;\nimport com.google.android.gms.maps.model.Marker;\n\npublic class MarkerAnimation {\n\n\tstatic void animateMarkerToGB(final Marker marker, final LatLng finalPosition, final LatLngInterpolator latLngInterpolator) {\n\t\tfinal LatLng startPosition = marker.getPosition();\n\t\tfinal Handler handler = new Handler();\n\t\tfinal long start = SystemClock.uptimeMillis();\n\t\tfinal Interpolator interpolator = new AccelerateDecelerateInterpolator();\n\t\tfinal float durationInMs = 500;\n\n\t\thandler.post(new Runnable() {\n\t\t\tlong elapsed;\n\t\t\tfloat t;\n\t\t\tfloat v;\n\n\t\t\t@Override\n\t\t\tpublic void run() {\n\t\t\t\t\/\/ Calculate progress using interpolator\n\t\t\t\telapsed = SystemClock.uptimeMillis() - start;\n\t\t\t\tt = elapsed \/ durationInMs;\n\t\t\t\tv = interpolator.getInterpolation(t);\n\n\t\t\t\tmarker.setPosition(latLngInterpolator.interpolate(v, startPosition, finalPosition));\n\n\t\t\t\tif (t &lt; 1) {\n\n\t\t\t\t\thandler.postDelayed(this, 16);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\t@TargetApi(Build.VERSION_CODES.HONEYCOMB)\n\tstatic void animateMarkerToHC(final Marker marker, final LatLng finalPosition, final LatLngInterpolator latLngInterpolator) {\n\t\tfinal LatLng startPosition = marker.getPosition();\n\n\t\tValueAnimator valueAnimator = new ValueAnimator();\n\t\tvalueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {\n\t\t\t@Override\n\t\t\tpublic void onAnimationUpdate(ValueAnimator animation) {\n\t\t\t\tfloat v = animation.getAnimatedFraction();\n\t\t\t\tLatLng newPosition = latLngInterpolator.interpolate(v, startPosition, finalPosition);\n\t\t\t\tmarker.setPosition(newPosition);\n\t\t\t}\n\t\t});\n\t\tvalueAnimator.setFloatValues(0, 1);\n\t\tvalueAnimator.setDuration(500);\n\t\tvalueAnimator.start();\n\t}\n\n\t@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)\n\tstatic void animateMarkerToICS(Marker marker, LatLng finalPosition, final LatLngInterpolator latLngInterpolator) {\n\t\tTypeEvaluator typeEvaluator = new TypeEvaluator() {\n\t\t\t@Override\n\t\t\tpublic LatLng evaluate(float fraction, LatLng startValue, LatLng endValue) {\n\t\t\t\treturn latLngInterpolator.interpolate(fraction, startValue, endValue);\n\t\t\t}\n\t\t};\n\t\tProperty property = Property.of(Marker.class, LatLng.class, \"position\");\n\t\tObjectAnimator animator = ObjectAnimator.ofObject(marker, property, typeEvaluator, finalPosition);\n\t\tanimator.setDuration(500);\n\t\tanimator.start();\n\t}\n}\n<\/pre>\n<h2>8. Modifying the AndroidManifest.xml<\/h2>\n<p>In order to make our map visible, we should have access to the Internet. This must be specified in the manifest, so that, our application will be granted the permission to use the Internet connection, with <strong>INTERNET<\/strong>, <strong>ACCESS_NETWORK_STATE<\/strong> and <strong>WRITE_EXTERNAL_STORAGE<\/strong>. Also, a good idea is to give permission <strong>ACCESS_COARSE_LOCATION<\/strong> and <strong>ACCESS_FINE_LOCATION<\/strong> for better Location results.<\/p>\n<p>Also, in order to add and use the Google Play Services library, we have to add the specific <code>meta-data<\/code> tag in our xml. Also, we should not forget the <strong>API KEY<\/strong> <code>meta-data<\/code> tag in our xml, in order to get permission to use Google Maps.<\/p>\n<p>The AndroidManifest.xml of our project is simple and contains the permissions:<\/p>\n<p><em><span style=\"text-decoration: underline;\">AndroidManifest.xml<\/span><\/em><\/p>\n<pre class=\"brush:xml; wrap-lines:false,highlight:[15,16,17,23,24,40,41,42,43,44,45]\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\n&lt;manifest xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\n    package=\"com.javacodegeeks.androidgooglemapsexample\"\n    android:versionCode=\"1\"\n    android:versionName=\"1.0\" &gt;\n\n    &lt;uses-sdk\n        android:minSdkVersion=\"9\"\n        android:targetSdkVersion=\"19\" \/&gt;\n\n    &lt;uses-feature\n        android:glEsVersion=\"0x00020000\"\n        android:required=\"true\" \/&gt;\n\n    &lt;uses-permission android:name=\"android.permission.INTERNET\" \/&gt;\n    &lt;uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" \/&gt;\n    &lt;uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\" \/&gt;\n\n    &lt;!--\n     The following two permissions are not required to use\n     Google Maps Android API v2, but are recommended.\n    --&gt;\n    &lt;uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\" \/&gt;\n    &lt;uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\" \/&gt;\n\n    &lt;application\n        android:allowBackup=\"true\"\n        android:icon=\"@drawable\/ic_launcher\"\n        android:label=\"@string\/app_name\" &gt;\n        &lt;activity\n            android:name=\".AndroidGoogleMapsActivity\"\n            android:label=\"@string\/app_name\" &gt;\n            &lt;intent-filter&gt;\n                &lt;action android:name=\"android.intent.action.MAIN\" \/&gt;\n\n                &lt;category android:name=\"android.intent.category.LAUNCHER\" \/&gt;\n            &lt;\/intent-filter&gt;\n        &lt;\/activity&gt;\n\n        &lt;meta-data\n            android:name=\"com.google.android.gms.version\"\n            android:value=\"@integer\/google_play_services_version\" \/&gt;\n        &lt;meta-data\n            android:name=\"com.google.android.maps.v2.API_KEY\"\n            android:value=\"AIzaSyAU9ShujnIg3IDQxtPrafaf7Q1qOvFVdwNmWc4\" \/&gt;\n    &lt;\/application&gt;\n\n&lt;\/manifest&gt;\n<\/pre>\n<h2>9. Build, compile and run<\/h2>\n<p>When we build, compile and run our project, the main AndroidGoogleMapsExample should look like this:<\/p>\n<p><figure id=\"attachment_20640\" aria-describedby=\"caption-attachment-20640\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndroidGoogleMapsExample-2.jpg\"><img decoding=\"async\" class=\"size-full wp-image-20640\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndroidGoogleMapsExample-2.jpg\" alt=\"Figure 21: This is how the main Activity with the Google maps Fragment looks like\" width=\"300\" height=\"533\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndroidGoogleMapsExample-2.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndroidGoogleMapsExample-2-169x300.jpg 169w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-20640\" class=\"wp-caption-text\">Figure 21: This is how the main Activity with the Google maps Fragment looks like<\/figcaption><\/figure><br \/>\n<figure id=\"attachment_20639\" aria-describedby=\"caption-attachment-20639\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndroidGoogleMapsExample-1.jpg\"><img decoding=\"async\" class=\"size-full wp-image-20639\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndroidGoogleMapsExample-1.jpg\" alt=\"Figure 22: This is how the Google Map v2 looks like after the first animation\" width=\"300\" height=\"533\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndroidGoogleMapsExample-1.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndroidGoogleMapsExample-1-169x300.jpg 169w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-20639\" class=\"wp-caption-text\">Figure 22: This is how the Google Map v2 looks like after the first animation<\/figcaption><\/figure><br \/>\n<figure id=\"attachment_20641\" aria-describedby=\"caption-attachment-20641\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndroidGoogleMapsExample-3.jpg\"><img decoding=\"async\" class=\"size-full wp-image-20641\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndroidGoogleMapsExample-3.jpg\" alt=\"Figure 23: This is how the Google Map v2 looks like after the second animation\" width=\"300\" height=\"533\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndroidGoogleMapsExample-3.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndroidGoogleMapsExample-3-169x300.jpg 169w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-20641\" class=\"wp-caption-text\">Figure 23: This is how the Google Map v2 looks like after the second animation<\/figcaption><\/figure><\/p>\n<h2>Download the Eclipse Project<\/h2>\n<p>This was the example of Android Google Maps v2.<\/p>\n<div class=\"download\"><strong>Download<br \/>\n<\/strong>You can download the full source code of this example here: <a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/AndroidGoogleMapsExample.zip\"><strong>AndroidGoogleMapsExample<\/strong><\/a><\/div>\n<h2>References<\/h2>\n<p>Animating Markers by Chris Broadfoot on: <a href=\"https:\/\/gist.github.com\/broady\/6314689\">http:\/\/gist.github.com\/broady\/6314689<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The great power of mobile applications software, is that it gives us the opportunity to develop many ideas that use hardware features, in order to complete simple everyday tasks. One idea that is implemented in a very good way in the mobile applications world, is the use of maps and the location based applications, that &hellip;<\/p>\n","protected":false},"author":14,"featured_media":1202,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-19893","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-google-maps"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Android Google Maps v2 Tutorial - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"The great power of mobile applications software, is that it gives us the opportunity to develop many ideas that use hardware features, in order to\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/examples.javacodegeeks.com\/android\/core\/google-maps\/android-google-maps-v2-tutorial\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Android Google Maps v2 Tutorial - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"The great power of mobile applications software, is that it gives us the opportunity to develop many ideas that use hardware features, in order to\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/android\/core\/google-maps\/android-google-maps-v2-tutorial\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2015-03-17T09:00:27+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-04-24T12:57:18+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Chryssa Aliferi\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Chryssa Aliferi\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"19 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/google-maps\/android-google-maps-v2-tutorial\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/google-maps\/android-google-maps-v2-tutorial\/\"},\"author\":{\"name\":\"Chryssa Aliferi\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/863144453b9fc15d4184d71833dcf332\"},\"headline\":\"Android Google Maps v2 Tutorial\",\"datePublished\":\"2015-03-17T09:00:27+00:00\",\"dateModified\":\"2019-04-24T12:57:18+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/google-maps\/android-google-maps-v2-tutorial\/\"},\"wordCount\":1753,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/google-maps\/android-google-maps-v2-tutorial\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\",\"articleSection\":[\"google maps\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/android\/core\/google-maps\/android-google-maps-v2-tutorial\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/google-maps\/android-google-maps-v2-tutorial\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/google-maps\/android-google-maps-v2-tutorial\/\",\"name\":\"Android Google Maps v2 Tutorial - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/google-maps\/android-google-maps-v2-tutorial\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/google-maps\/android-google-maps-v2-tutorial\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\",\"datePublished\":\"2015-03-17T09:00:27+00:00\",\"dateModified\":\"2019-04-24T12:57:18+00:00\",\"description\":\"The great power of mobile applications software, is that it gives us the opportunity to develop many ideas that use hardware features, in order to\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/google-maps\/android-google-maps-v2-tutorial\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/android\/core\/google-maps\/android-google-maps-v2-tutorial\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/google-maps\/android-google-maps-v2-tutorial\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/google-maps\/android-google-maps-v2-tutorial\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Android\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/android\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"core\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/android\/core\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"google maps\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/android\/core\/google-maps\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Android Google Maps v2 Tutorial\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/863144453b9fc15d4184d71833dcf332\",\"name\":\"Chryssa Aliferi\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/03\/Chryssa-Aliferi-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/03\/Chryssa-Aliferi-96x96.jpg\",\"caption\":\"Chryssa Aliferi\"},\"description\":\"Chryssa is a Computer Science graduate from Athens University of Economic and Business. During her studies, Chryssa carried out a great variety of projects ranging from networking to software engineering. She is very keen on front end development especially on mobile technologies and web applications. She has worked as a junior Software Engineer in the telecommunications area and currently works as an Android Developer.\",\"sameAs\":[\"http:\/\/www.javacodegeeks.com\/\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/chryssa-aliferi\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Android Google Maps v2 Tutorial - Java Code Geeks","description":"The great power of mobile applications software, is that it gives us the opportunity to develop many ideas that use hardware features, in order to","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/examples.javacodegeeks.com\/android\/core\/google-maps\/android-google-maps-v2-tutorial\/","og_locale":"en_US","og_type":"article","og_title":"Android Google Maps v2 Tutorial - Java Code Geeks","og_description":"The great power of mobile applications software, is that it gives us the opportunity to develop many ideas that use hardware features, in order to","og_url":"https:\/\/examples.javacodegeeks.com\/android\/core\/google-maps\/android-google-maps-v2-tutorial\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2015-03-17T09:00:27+00:00","article_modified_time":"2019-04-24T12:57:18+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","type":"image\/jpeg"}],"author":"Chryssa Aliferi","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Chryssa Aliferi","Est. reading time":"19 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/google-maps\/android-google-maps-v2-tutorial\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/google-maps\/android-google-maps-v2-tutorial\/"},"author":{"name":"Chryssa Aliferi","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/863144453b9fc15d4184d71833dcf332"},"headline":"Android Google Maps v2 Tutorial","datePublished":"2015-03-17T09:00:27+00:00","dateModified":"2019-04-24T12:57:18+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/google-maps\/android-google-maps-v2-tutorial\/"},"wordCount":1753,"commentCount":1,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/google-maps\/android-google-maps-v2-tutorial\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","articleSection":["google maps"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/android\/core\/google-maps\/android-google-maps-v2-tutorial\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/google-maps\/android-google-maps-v2-tutorial\/","url":"https:\/\/examples.javacodegeeks.com\/android\/core\/google-maps\/android-google-maps-v2-tutorial\/","name":"Android Google Maps v2 Tutorial - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/google-maps\/android-google-maps-v2-tutorial\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/google-maps\/android-google-maps-v2-tutorial\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","datePublished":"2015-03-17T09:00:27+00:00","dateModified":"2019-04-24T12:57:18+00:00","description":"The great power of mobile applications software, is that it gives us the opportunity to develop many ideas that use hardware features, in order to","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/google-maps\/android-google-maps-v2-tutorial\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/android\/core\/google-maps\/android-google-maps-v2-tutorial\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/google-maps\/android-google-maps-v2-tutorial\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/google-maps\/android-google-maps-v2-tutorial\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Android","item":"https:\/\/examples.javacodegeeks.com\/category\/android\/"},{"@type":"ListItem","position":3,"name":"core","item":"https:\/\/examples.javacodegeeks.com\/category\/android\/core\/"},{"@type":"ListItem","position":4,"name":"google maps","item":"https:\/\/examples.javacodegeeks.com\/category\/android\/core\/google-maps\/"},{"@type":"ListItem","position":5,"name":"Android Google Maps v2 Tutorial"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/863144453b9fc15d4184d71833dcf332","name":"Chryssa Aliferi","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/03\/Chryssa-Aliferi-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/03\/Chryssa-Aliferi-96x96.jpg","caption":"Chryssa Aliferi"},"description":"Chryssa is a Computer Science graduate from Athens University of Economic and Business. During her studies, Chryssa carried out a great variety of projects ranging from networking to software engineering. She is very keen on front end development especially on mobile technologies and web applications. She has worked as a junior Software Engineer in the telecommunications area and currently works as an Android Developer.","sameAs":["http:\/\/www.javacodegeeks.com\/"],"url":"https:\/\/examples.javacodegeeks.com\/author\/chryssa-aliferi\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/19893","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/14"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=19893"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/19893\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/1202"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=19893"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=19893"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=19893"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}