You are currently browsing the monthly archive for May 2012.
I have been trying this for a month and a lot of my readers asked to write a tutorial that makes it easy to draw a line on Google Maps for Android between two locations. I have gone through a lot of material. Most of the articles on this exact issue are not exactly addressing this specific issue. So their code is way too complex for this simple task. I have tried to make this as simple as possible.
Assumption About The Reader:
At this point I assume that reader of this article have already configured everything and Google Maps are displayed in their emulator properly. For those who don’t have Google Maps properly displayed in their emulator, they can read my earlier articles. Links provided at the end of this article.
Draw a line that between two points on Google Maps lets say City “A” and City “B”. Repeat…
View original post 464 more words
To get going with this tutorial I am using the code from my previous tutorial https://mirnauman.wordpress.com/2012/04/10/android-google-maps-tutorial-part-5-adding-multiple-images-to-google-maps-using-itemizedoverlay/
To get the Latitude and Longitude values of a location that is touched on Google Maps in Android.
All we need is a simple function onTouchEvent(MotionEvent event, MapView mapView), that can be added to either a Class that extends Overlay or a Class that extends ItemizedOverlay. In my tutorial I have used ItemizedOverlay so I ll add the function to my class “MirItemizedOverlay” that extends ItemizedOverlay.
Function to be added:-
Now when we Run the Application and touch the sceen. As soon as we lift the touch, the application will display the Latitude and Longitude values in a Toast.
Complete code of tutorial Google Maps Part 5 will become
View original post 38 more words
Dear readers am back after a long time trying to complete what i started a few months back. This article is part 5 of the previous series but it doesn’t depend on the code of the previous articles, still they can be referenced to get a better understanding of configuring Google Maps for Android and learning the basic development of Google Maps for Android. The development environment stays the same as of the previous articles. No change in any of the configurations etc.
Please see the links for previous articles for basics of Google Maps for Android.
Objective of this article is to add multiple images to our Google Map Application for Android. I have taken a scenario where I have a list of coordinates of different cities of Pakistan and I want display an image on each city. Check the final output of this article so that you have an idea of what we…
View original post 354 more words
To get going with this tutorial one needs to go through all the previous 3 parts because we are using the same code from the previous tutorials and taking it a few steps further.
Our main emphasis in this tutorial will be on adding a Menu to our Android GoogleMaps project and perform different actions using the buttons of that menu. So wat we will do is to create a menu with 3 buttons. Just like the one shown in the image below.
- My Current Location Button
- Map Satellite View Button
- Map Normal View Button
Before we start we will copy 3 images(mylocation.png,satelliteview.png,normalview.png) in the drawables folder in the res folder. After this we will create a new xml file in the layout folder. We will name our file as “menu.xml”. The code for menu.xml is given below.
Save the menu.xml file and open GooglemapsActivity.java file. Now add the…
View original post 514 more words
Objective of this tutorial is to place an image to the current location of the device, means displaying an image at the current coordinates from the GPS of the device. We can have a better idea from the image displayed below of what we are trying to achieve.
To start with this tutorial we will continue with the examples from the previous tutorial and to have the exact output one must go through the previous tutorials in this series i.e,
First of all we will create a PNG image with transparent background or download it from Google or search it in the android samples folders. When we have our desired image just like the one shown below.
Copy this PNG and browse to your “res” folder of the GoogleMaps project. My path for the “res” folder is “C:\Users\Mir Nauman Tahir\workspace\googlemaps\res\” . In “res” folder we will have 3 more…
View original post 462 more words
In this tutorial we will make our way to get Coordinates from GPS. We will use the emulator, will learn how to use the emulator and how to use the DDMS and how we can send coordinates from DDMS to our emulator. We will start with a very basic application that will get coordinates from the GPS and will display it in a Toast. In the second part of this tutorial we will use those coordinates and will make our Google Maps animate to that location automatically. For using Google Maps Basics follow the link
We will continue with the code in the above example, using the same API and AVD. First of all add the following permission in the AndroidManifest.xml file, if its not been already added.
Secondly check the AVD that is it with GPS support or not. As we can see in the hardware section that “GPS Support” has…
View original post 353 more words
To use Google Maps in Android using MapView Control we need Google Maps API Key. To get the key we have to go through the following steps.
- Locate debug.keystore file on your system.
- Locate keytool.exe file on your system
- Generate MD5 fingerprint.
- Use that MD5 fingerprint to get the Google Maps API Key
The debug.keystore file can be found at “c:\users\mir nauman tahir\.android\debug.keystore”
Replace “mir nauman tahir” with your current user name.
Now navigate to keytool.exe file. “c:\program files\java\jdk1.7.0_02\bin\keytool.exe”
Replace the jdk version with the version installed on your system.
Now execute the following command.
C:\Program Files\Java\jdk1.7.0_02\bin>keytool.exe -list -alias androiddebugkey -keystore “c:\users\mir nauman tahir\.android\debug.keystore” -storepass android -keypass android
If prompted for a password, try “changeit” or just press enter key to enter an empty password. This command will return SHA1 fingerprint. jdk1.7 or higher will return SHA1 by default. Remember the bold and italic text is the path to the debug.keystore…
View original post 187 more words