‫Hello guys and welcome to Master Coding Channel and the complete Android Developer course on Udemy.
‫In this tutorial we are going to add an info window for our marker and see how they work.
‫So if this is your first time here on our YouTube channel, please subscribe and hit the bell so you
‫don't miss any future tutorials.
‫And on Udemy please rate us five stars to get the free coupons and next courses.
‫So an info window allow allows you to display information to the user when they tap on the marker.
‫So if I tap in the on the marker, this info window will display its title called marker one.
‫So only one info window will be displayed at a time.
‫If a user clicks on the marker, the current info window will be closed and the new info window will
‫be displayed.
‫Note that if the user clicks on the marker that is currently showing an info window, that info window
‫closes and reopens.
‫So like in this way now, in order to create an info window, as I showed you in the previous videos,
‫that you can add a title and a position, I will remove this, I will keep it draggable and a title
‫called My Marker.
‫We see these properties in the previous video.
‫Now I will click on it.
‫My marker.
‫Now I told you I can use the snippet.
‫I can put like population, population or lat long lat.
‫And long.
‫I can't put it.
‫It will display the snippet, as I told you.
‫Let 20 and longitude as 40.
‫I click run and see what's happened.
‫Okay.
‫When I click let is 20 and longitude is 40.
‫Now here come the magic for creating an info window.
‫Now
‫let's try to get the let k dot get position or a marker.
‫Plus marker.
‫Marker dot get position dot.
‫Get or latitude.
‫Latitude.
‫Let's run and see if the marker.
‫Okay.
‫It will it will not work because there is there is an error because the snippet cannot take a cannot
‫take the variable in this way.
‫Now, what is the the solution for this?
‫We are going to make an draggable instance or an draggable click listener.
‫Now
‫we see that lad is displayed without our variable.
‫Now let's create a like a custom the custom info window.
‫For that we are going to create a info window, click listener and and override them for for now it's
‫very good to implement here the interface for on on info window click window click listener.
‫Okay, I will click on L plus insert a enter and implement the method and on info window and I will
‫pass the map.
‫Dot map dot.
‫Set on map.
‫On info.
‫Window on info window.
‫Click listener and I call it this for window marker and I will toast the message and display a toast
‫message lung and info window.
‫Info window is clicked.
‫Let's run.
‫So this listener and this interface method is from the interface on Infowindow Click listener interface.
‫And this method will override.
‫It will be override it and display a toast message saying that Infowindow is clicked.
‫So when I will click on the marker, I click on the info window.
‫The info window is clicked, toast message is displayed.
‫Okay, here we can add the toast message or sorry, a click listener for the uh, for the info window.
‫Okay, so now it's very clear.
‫So in this video we have learned how to create an info window and use it inside our Google Maps application.
‫So guys, if we are if you are interested in learning coding and other Android Java and other coding
‫tutorials, please subscribe below to our YouTube channel and rate us five stars on Udemy.
‫So you get the free coupons and you learn in the fastest way with a complete and real examples freely.
‫So subscribe to keep us making new tutorials.
‫See you in the next videos guys.
‫Bye bye.