Welcome back.
In the previous video, we created this map style on map style with google.com.
And we copied this JSON code and we paste it inside a new file called retro underscore style JSON placed
in row and resource folder.
Okay, so this is our code.
This is our style in JSON.
Now we need to apply this style to our current map in Android.
Let's move up.
And before the Google map we need to create the custom style retro style.
Let's start with val context equals to local context dot current.
This is the context here outside the remember and outside any composable then val retro style equals
to Remember context dot resource dot open row resource set the path are the row dot retro style.
I'm accessing the file that we just created in the row folder which is the JSON file.
And here I am telling Android Studio to start reading it.
Buffered read dot use it dot read text.
Here I am reading the text and storing it inside this variable called retro style.
Now let's apply this style to the map.
Scroll down Google Map and here the properties map properties and set the map style options equals to
Map style options and path the retro style.
Let's learn about the map style options.
Ctrl and left click to open this map.
Style options.
It's a class from Google Maps um, Android SDK that applies a custom visual style to the map.
It expects a JSON string that describes how you want to style map elements like roads, water parks,
text labels, land areas, and more.
Okay, so I used this class called Map Style Options and I passed the retro style that I created before.
Let me run the app and see if the style is applied to our map or not.
Our style is not applied, so let me disable the map type here by commenting it, so I comment.
This map type run again and congratulations guys!
We successfully applied the style that we created on Google Maps, and we use it here so you can place
markers.
You look guys uh, you notice the borders between the countries is in blue and you can place the markers.
Uh, you can notice that there are no roads, only the main roads between the countries.
The that labels the landmarks disappeared.
So you can create your custom, custom maps using this way.
Using this style.
Okay.
So congratulations, guys.
We succeeded in creating our custom map style.
And this is a very important thing you should know.