Move a marker between 2 coordinates following driving directions : <p>I want to move a marker from one Latlng to another. I have used this code to move the marker smoothly based on Distance and Time.</p>

<pre><code>public void animateMarker(final LatLng toPosition,
                              final boolean hideMarker) {
        final Handler handler = new Handler();
        final long start = SystemClock.uptimeMillis();
        Projection proj = googleMap.getProjection();
        Point startPoint = proj.toScreenLocation(cabMarker.getPosition());
        final LatLng startLatLng = proj.fromScreenLocation(startPoint);

        final Interpolator interpolator = new LinearInterpolator();

        handler.post(new Runnable() {
            @Override
            public void run() {

                Location prevLoc = new Location("service Provider");
                prevLoc.setLatitude(startLatLng.latitude);
                prevLoc.setLongitude(startLatLng.longitude);

                Location newLoc = new Location("service Provider");
                newLoc.setLatitude(toPosition.latitude);
                newLoc.setLongitude(toPosition.longitude);

                System.out.println("Locations ---- " + prevLoc + "-" + newLoc);

                float bearing = prevLoc.bearingTo(newLoc);

                long elapsed = SystemClock.uptimeMillis() - start;
                float t = interpolator.getInterpolation((float) elapsed
                        / CAB_TRACK_INTERVAL);
                double lng = t * toPosition.longitude + (1 - t)
                        * startLatLng.longitude;
                double lat = t * toPosition.latitude + (1 - t)
                        * startLatLng.latitude;
                cabMarker.setPosition(new LatLng(lat, lng));
                cabMarker.setRotation(bearing + 90);

                if (t &lt; 1.0) {
                    // Post again 16ms later.
                    handler.postDelayed(this, 16);
                } else {
                    if (hideMarker) {
                        cabMarker.setVisible(false);
                    } else {
                        cabMarker.setVisible(true);
                    }
                }
            }
        });


    }
</code></pre>

<p>But the problem is marker wont move on driving directions but in a straight line from A to B. Is it possible to get around 10 road midpoints in between A and B and then and move it along that path? </p>
