Working with AMap in Android – Part 2 (Switching between map type and adding marker)

Updated 29 May 2017


In the last part of the working with AMaps we learned about how to show a basic map in your activity. In this section we will learn about using different may type (Like NORMAL, SATELLITE, NIGHT etc.) in the app and adding markers.


We will be considering that you have already applied the basic map on the app if not then you can go to this link and learn how to do it.

After this, you have to create some buttons in your layout which will control the map types and on the button click all you need to do is call the setMapType of AMap‘s object.

This will change the map type and your map will work accordingly.


Now let us see how to add the marker on your map. It is quite easy actually, there is a MarkerOptions class which will help you to do that. Try the below code with a Latlng and it will add a marker on your map.

In the above code BitmapDescriptorFactory.HUE_AZURE defines the type of your marker. They have provide inbuilt markers with various color. You can go for HUE_BLUE, HUE_RED etc.

After the MarkerOptions object is initialized you need yo call the addMarker function of your AMap‘s object and it will draw a marker on the map.

Thank you very much, this is Vedesh Kumar signing off.


<—– PART 1

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*

Be the first to comment.

Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home