i want show marker of own choice in place of default blue colored icon. how can change same.
currently adding manually @ current location.
@override public void onmylocationchange(location location) { // creating latlng object current location latlng latlng = new latlng(location.getlatitude(), location.getlongitude()); // showing current location in google map cameraupdate cameraupdate = cameraupdatefactory.newlatlngzoom( latlng, 15); googlemap.animatecamera(cameraupdate); marker = googlemap.addmarker(new markeroptions() .position(latlng) .title("current location(you)") .snippet("current") .icon(bitmapdescriptorfactory .fromresource(r.drawable.green_loc_icon)) .draggable(true)); } });
it's explained in documentation:
https://developers.google.com/maps/documentation/android/marker#change_the_default_marker
please remember remove marker before adding new one, otherwise each time update user location you'll add new marker on map.
since you're showing other markers on map, hold reference user current location marker , use remove() method before creating new instance.
Comments
Post a Comment