Android Google Map Custom Marker Icon,Image,Color,Size,Title,Name

This page is about Android Google Map Custom Marker Icon with Image,Color,Size,Title and Name programmatically.

Google map gives us many ways to customize the look and feel of the map. One of them is to customize the marker.

By default, google map shows the red icon marker but we can change this red icon marker with our custom image and icon.

You can also change the Title, Name, Snippet, Size etc. of the marker to make it more attractive.

We have to work with some methods and options provided by android’s in built library to accomplish our task.

In this tutorial, I will show you how to do this with one practical example in android studio.

Google Map Image

Final output for our example is as the below image

android google map custom marker

Output with Custom markers

Wait Before You Start

To integrate the google map in your android app, you need to have one Google API Key.

You need to create one app in the Google developer console to generate this API Key.

I have already written one separate article on this topic. Read it here : Android Integrate Google Map with API Key.

Just follow the “Work At Google Developer Console” part of this tutorial. After this, you will have one Google API Key which you need to write in your android studio project.

After getting Your Key, create new project in android studio.

Step 1. Default Activity

When you are creating new project in android studio, after giving project name, project directory and SDK level you need to select the activity type.

Activity type screen should look like the below picture

google map integration in android, android current location on google map, android google map custom marker

Select Google Map Activity

As you can see in the above image, there are many options like Basic Activity, Bottom Navigation Activity, Login Activity etc.

Among them select “Google Maps Activity” because it will load google map automatically to our default activity.

Thus, it will save our time and we do not need to write extra coding lines.

Step 2. Adding API Key

Now it is time to add the Google API Key, that you generated in the google developer console.

  • There is a file named “google_maps_api.xml” in the res->values directory
  • You need to write your key in this file.

Source Code for this file should look like below snippet

In the above code, last line have <string > </string> tags. You should write your Google API Key just between these two tags.

Step 3. Finishing the Changes

At last we just need to update the coding structure of file.

There should be some code lines already written by the compiler.

But replace all of them with the below lines including import statements.

Now let us read above code step by step.

Following code snippet is first one.

  • Above lines will simply initiate the google map.
  • When compiler is ready to create a google map, it will call onMapReady() method.

Following is the first few writings for onMapReady() method.

  • First line will set the google map type. By default NORMAL MODE is selected.
  • You can choose other options like : HYBRID, SATELLITE, TERRAIN etc.
  • Then after camera options and position are specified. You need to give latitude and longitude in .target() option.

Now let us read how to customize markers.

I have created four markers like the above code snippet.

Customizing Marker Title

.title(“Taj Mahal”) 

For customizing title of the marker, you just need to update the above line.

Customizing Marker Snippet or Text

.snippet(“It is located in India”)

Above line will help you to add some description about the marker.

Customization of Marker Icon


  • Above line helps you to have custom image as a marker icon. All you need is to save your image into drawable folder.
  • Here, I have used bitmapDescriptorFromVector() method to get the bitmap from the image.

Following is the source code for bitmapDescriptorFromVector() method

Changing Marker Color


Above line will generate violet colored marker with the default shape.

Change various colors to make your marker more beautiful.

Other References On Map

Below are some useful examples for Google map in android.

Download Source Code For Android Google Map Custom Marker

[sociallocker]Download Source Code For Google Custom Marker[/sociallocker]

Hardik Parsania

I am mobile app developer. I am always passionate about solving complex and real world problems.I have developed many apps with great interest and superior logical skills.

You may also like...

Leave a Reply

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