Map Marker Example In Android

This example show you how to draw movable marker on to map. You can darg and drop the marker to change its position. Can be used in any application where u want to take input from user for map location.

Algorithm:

1.) Create a new project by File-> New -> Android Project name it MapMarkerExample.
2.) You will see some default code into your main.xml and android manifest file.
3.) Add internet permission to your manifest file or write following in android.manifest file:

 

 

 

4.) Write following into main.xml file:

 

 

 

5.) CreateYour own map API key and replace it in above main.xml.
6.) Add any marker image or push pin image in drawable folder.
7.) Run for output.

Steps:

1.) Create a project named MapMarkerExample and set the information as stated in the image.

Build Target: Android 2.1 (Google API)
Application Name: MapMarkerExample
Package Name: com.example.mapmarker
Activity Name: MapMarkerActivity
Min SDK Version: 7

2.) Open MapMarkerActivity.java file and write following code there:

 

 

 

3.) Compile and build the project.
4.) Move the marker shown on the map with the help of mouse for results shown below.

Output

Leave a Comment:

8 comments
Karthika says December 1, 2011

I need library files (JAR) for this..

Reply
Ganesh says September 29, 2012

Thanks very nice…

Reply
kunal says October 23, 2012

It didn’t work for me:(

Reply
Dipankar says October 25, 2012

Great tutorial…..it elp me a lot…keep this type of wo’rk well done !!

Reply
Philippe says November 11, 2012

“Unfortunately, MapMarkerExample has stopped”
Can you help me
Thank you from France Cote d’Azur – Thanks for the job

Reply
Vishal says December 1, 2012

Hey can i put multiple markers on it.if yes plz help me how will it do

Reply
Charith says December 3, 2012

How to add two Drawable marker in the map.??

Reply
rameh says April 17, 2013

thanks a lot

Reply
Add Your Reply