Welcome back.
We added the clustering library dependency.
Now let's move to the main activity.
And here let's move to the Google map scope.
Let's start by marker clustering.
Start with clustering.
And here we have this composable function I want from you to focus with me.
Select Clustering Ctrl and left click to open the declaration.
And here we can notice that it's a public function.
Clustering takes whatever any collection of that extends from cluster item and items collection T.
This is very important because we're going to see what what uh what is the problem with this library
and why we should pay attention to this declaration.
And we have a lot of things we can, uh, declare on marker.
Click on info window.
Click on marker.
Drag on info window.
Click marker.
Drag end and marker drag start okay.
Also, we can see a lot of things inside this composable function.
Also, we can notice that we have the cluster.
Another version of the clustering items collection of T on cluster.
Click we can handle on cluster.
Click also on cluster item click.
You can also define if the user clicks on the marker inside the cluster, or the user clicks on the
cluster in general.
Also, if the user clicks on the info window of the cluster item, also click Cluster Content, Cluster
Item Content and on Cluster Manager.
So we need this version of clustering.
So back to here you can remove clustering and you can select here from those three cluster items from
the clustering.
So clustering you should specify some mandatory parameters like the items equals to.
And here we need to specify the list of markers that we need to make a cluster.
Okay.
So I want from you to pay attention with me now because there is a very important note.
You should pay attention to it.
Okay.
Let me create a list of markers.
So here outside the Google map let me create the variables for the clustering example list of and here
we need to for example make a marker list of markers and or.
Let long.
Let me start with lat long set.
For example the first lat long at the equator zero zero.
The second one is near it okay.
So this this is the cluster items as of list of lat long.
Now let's scroll down to clustering inside the Google Maps and let's specify the cluster items here.
There is a very important note you should pay attention to it.
Required cluster item but found lat long.
If we create any type of lists it will give us this type of error.
Type mismatch.
Required.
Cluster item found.
Lat long.
So let's go back to the cluster items.
And here it's list of lat long.
Let me try list of markers for example.
Okay.
Also we will get the same error.
It's of type marker required cluster item.
How to solve it.
In the next video, we're going to create the cluster item that extends from cluster item.
And we're going to create the custom items to be displayed for the clusters.