title: How to move marker from one location to another location when we have a list of locations on google map android
body: <p>i am creating google map with multiple markers.Now i want to move a car icon between that markers.Using this  <a href="https://stackoverflow.com/questions/13728041/move-markers-in-google-map-v2-android">Move markers in google map v2 android</a></p>
  
  <p>I can move a car icon between from first point to second point.But it is not moving from second to third.When i used for loop for this it strightly goes to final point.I added delay also but nothing else worked for me.</p>
  
  <p>Thanks in advance.</p>
  
  <p>This is my code::</p>
  
  <pre><code>public void setAnimation(GoogleMap myMap, final List&lt;LatLng&gt; directionPoint) {
  
          anim_map = myMap;
  
  
          anim_marker = myMap.addMarker(new MarkerOptions()
                  .icon(BitmapDescriptorFactory.fromResource(R.drawable.bus_icon))
                  .position(directionPoint.get(0))
                  .flat(true));
  
  
          myMap.animateCamera(CameraUpdateFactory.newLatLngZoom(directionPoint.get(0), 10));
  
          if (directionPoint.size() &gt;= 2) {
  
              for (int i = 0; i &lt; directionPoint.size() - 1; i++) {
                  h.post(new Runnable() {
                      @Override
                      public void run() {
                          animateMarker(anim_map, anim_marker, directionPoint, false);
  
  
  
                      }
                  });
  
  
              }
  
          }
  
  
      }
  
  private void animateMarker(GoogleMap myMap, final Marker marker, final List&lt;LatLng&gt; directionPoint,
                                 final boolean hideMarker) {
  
          final long start = SystemClock.uptimeMillis();
          final long duration = 350000;
          final Interpolator interpolator = new LinearInterpolator();
  
  
          h.post(new Runnable() {
              int i = 0;
  
              @Override
              public void run() {
                  long elapsed = SystemClock.uptimeMillis() - start;
                  float t = interpolator.getInterpolation((float) elapsed
                          / duration);
  
                  //  Log.e("T Location", t + "");
  
  
                  double lng = t * directionPoint.get(i + 1).longitude + (1 - t) * directionPoint.get(i).longitude;
                  double lat = t * directionPoint.get(i + 1).latitude + (1 - t) * directionPoint.get(i).latitude;
                  marker.setPosition(new LatLng(lat, lng));
  
                  if (t &lt; 1.0) {
                      h.postDelayed(this, 1);
                  } else {
                      if (hideMarker) {
                          marker.setVisible(false);
                      } else {
                          marker.setVisible(true);
                      }
                  }
  
  
              }
          });
  
  
      }
  </code></pre>