Android App Development
iOS App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 126.96.36.199 release ready!
Owner and Founder. Opencart
In the last part of the working with AMaps, we learned about changing the map type and adding markers. Now we will learn about adding click listeners on the markers and showing InfoDialog on them.
After you have created the AMap and added the marker on it, You will have to implement an Interface called OnMarkerClickListener in your activity and override its onMarkerClick(Marker marker) function which will be called whenever a marker is clicked.
You can perform any kind of task like showing toasts or animating the marker. Let us see an example of this. After the implementation of the Interface, you need to set the click listener on your_amap.
And now whenever your marker is clicked onMarkerClick(Marker marker) function will be called and you can perform the task in it. Look at the example given below
In the above code snippet, You can see that we have performed two actions on marker click. One is making a toast and the other one is making an animation of marker jumping. You can check the jumpPoint fucntion below.
Now if you want to add an InfoWindow on the marker like showing some important information over the marker. It is quite simple. All you need to do is while creating your marker use title function for adding the title and snippet function for adding some details. Look at the below provided code snippet for example.
That’s all for this section, We will study about more amazing AMap functionalities in the next sections
Thank you very much, this is Vedesh Kumar signing off.
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
The results provided were above our expectations both in deliverability timeline as well as operation. They are a top-notch company with many resources and a company we feel honoured to work with again!
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.