I'm currently developing an android application that would allow users to draw Polylines with Markers on the map. Right now, I would like to implement a feature whereby the polyline will be draggable whenever the marker is being dragged and update the Polyline when the onMarkerDragEnd() method is being called. Does anyone know how I can achieve this? Below is a snippet of my codes. Thanks!
googleMap.setOnMapClickListener(new OnMapClickListener(){
@Override
public void onMapClick(LatLng point) {
// TODO Auto-generated method stub
if(drawMode == true && arrayPoints.isEmpty()){
MarkerOptions marker=new MarkerOptions();
marker.position(point);
googleMap.addMarker(marker).setDraggable(true);
arrayPoints.add(point);
marker.draggable(true);
}
else if(drawMode == true){
Log.e("","IN SECOND");
MarkerOptions marker=new MarkerOptions();
marker.position(point);
googleMap.addMarker(marker).setDraggable(true);
arrayPoints.add(point);
PolylineOptions polylineOptions = new PolylineOptions();
polylineOptions.color(Color.BLUE);
polylineOptions.width(5);
polylineOptions.addAll(arrayPoints);
Polyline drawRoute = googleMap.addPolyline(polylineOptions);
}
}
});