Xamarin Android Google Map - Add marker where user clicks -


in xamarin forms, using custom renderer in android map have implemented using android.gms.maps want write functionality adds marker in area user clicked on map.

    public async void onmapready(googlemap googlemap)     {         map.mapclick+= handlemapclick;     } 

in handlemapclick() function, how use addmarker() function add marker area user clicked on map?

the googlemap.mapclickeventargs contains "point" contains lat/long of user' click. create markeroption, assign point , add map.

googlemap.mapclick += (object sender, googlemap.mapclickeventargs e) => {     using (var markeroption = new markeroptions())     {         markeroption.setposition(e.point);         markeroption.settitle("stackoverflow");         // save "marker" variable returned if need move, delete, update it, etc...         var marker = googlemap.addmarker(markeroption);     } }; 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -