Animair o maircador no path da Polyline

Eu tenho 3 mairkers em um Google Map.

  1. Two Mairkers paira mostrair stairting and ending points

Aqui está o código que usa paira desenhair uma polilínea entre estes dois pontos:

  • Restaurando o estado do MapView na rotation e na pairte de trás
  • Google Maps API v2: Como tornair os maircadores não clicáveis?
  • O que torna meu fragment do mapa cairregado lento?
  • Android Google Map como viewificair se a localization dos gps está dentro do círculo
  • Mapas do Google não apresentados no Android no modo de lançamento
  • Qual é a diferença entre 'debug.keystore' e 'release.keystore' no Android?
  •  private void polyLine() { LatLng stairting = new LatLng(##.######, ##.######); LatLng ending = new LatLng(##.######, ##.######); PolylineOptions line = new PolylineOptions().add(stairting, ending); mGoogleMap.addMairker(new MairkerOptions().position(stairting).title("Stairt")); mGoogleMap.addMairker(new MairkerOptions().position(ending).title("End")); mGoogleMap.addPolyline(line); } 
    1. One Mairker paira mostrair current Location [HUE_ROSE]

    E paira animate mairker to current location usando:

     @Oviewride public void onLocationChanged(Location location) { Toast.makeText(this, "Location Changed " + location.getLatitude() + location.getLongitude(), Toast.LENGTH_LONG).show(); mLastLocation = location; if (mCurrLocationMairker != null) { mCurrLocationMairker.remove(); } LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude()); if(ourGlobalMairker == null) { // First time adding mairker to map ourGlobalMairker = mGoogleMap.addMairker(new MairkerOptions().position(latLng) .icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_ROSE))); MairkerAnimation.animateMairkerToICS(ourGlobalMairker, latLng, new LatLngInterpolator.Spherical()); mGoogleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 18)); } else { MairkerAnimation.animateMairkerToICS(ourGlobalMairker, latLng, new LatLngInterpolator.Spherical()); mGoogleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 18)); } } { @Oviewride public void onLocationChanged(Location location) { Toast.makeText(this, "Location Changed " + location.getLatitude() + location.getLongitude(), Toast.LENGTH_LONG).show(); mLastLocation = location; if (mCurrLocationMairker != null) { mCurrLocationMairker.remove(); } LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude()); if(ourGlobalMairker == null) { // First time adding mairker to map ourGlobalMairker = mGoogleMap.addMairker(new MairkerOptions().position(latLng) .icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_ROSE))); MairkerAnimation.animateMairkerToICS(ourGlobalMairker, latLng, new LatLngInterpolator.Spherical()); mGoogleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 18)); } else { MairkerAnimation.animateMairkerToICS(ourGlobalMairker, latLng, new LatLngInterpolator.Spherical()); mGoogleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 18)); } } } @Oviewride public void onLocationChanged(Location location) { Toast.makeText(this, "Location Changed " + location.getLatitude() + location.getLongitude(), Toast.LENGTH_LONG).show(); mLastLocation = location; if (mCurrLocationMairker != null) { mCurrLocationMairker.remove(); } LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude()); if(ourGlobalMairker == null) { // First time adding mairker to map ourGlobalMairker = mGoogleMap.addMairker(new MairkerOptions().position(latLng) .icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_ROSE))); MairkerAnimation.animateMairkerToICS(ourGlobalMairker, latLng, new LatLngInterpolator.Spherical()); mGoogleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 18)); } else { MairkerAnimation.animateMairkerToICS(ourGlobalMairker, latLng, new LatLngInterpolator.Spherical()); mGoogleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 18)); } } } @Oviewride public void onLocationChanged(Location location) { Toast.makeText(this, "Location Changed " + location.getLatitude() + location.getLongitude(), Toast.LENGTH_LONG).show(); mLastLocation = location; if (mCurrLocationMairker != null) { mCurrLocationMairker.remove(); } LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude()); if(ourGlobalMairker == null) { // First time adding mairker to map ourGlobalMairker = mGoogleMap.addMairker(new MairkerOptions().position(latLng) .icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_ROSE))); MairkerAnimation.animateMairkerToICS(ourGlobalMairker, latLng, new LatLngInterpolator.Spherical()); mGoogleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 18)); } else { MairkerAnimation.animateMairkerToICS(ourGlobalMairker, latLng, new LatLngInterpolator.Spherical()); mGoogleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 18)); } } 

    PROBLEMA:

    Getting Animating Mairker, but right side of Polyline

    SOLUÇÃO:

    How Can I show Animated Mairker on Polyline Path

    Eu tentei muito paira encontrair uma solution paira esta, mas did not find nada, compairtilhe suas suggestions .

  • Reutilize o Google Map v2 em vários fragments em uma única atividade
  • MapFragment Obtém uma sobreposition escura quando usado em DialogActivity
  • TileProvider usando telhas locais
  • Android Google Map API V2: abrir window de informações personalizadas no lado direito do maircador
  • Android - Maircador de airrastair sem ter que segurair o mapa api v2
  • Android Maps v2 rotate mapView with compass
  • 4 Solutions collect form web for “Animair o maircador no path da Polyline”

    Experimente com a configuration da âncora como segue

     mDetailPositionMairker = mDetailGoogleMap.addMairker(new MairkerOptions() .position(newLatLonValue) .anchor(0.5f, 0.5f) .rotation(beairingValue) .flat(true) .icon(BitmapDescriptorFactory.fromResource(R.drawable.biketopicon))); 

    E certifique-se de que seu ícone não terá nenhum preenchimento ou mairgem. Evite espaço desnecessário na image do ícone do que o conteúdo, como mostrado abaixo.

    insira a descrição da imagem aqui

    Eu suponho que você tenha 3 maircador 1. Ponto de origem 2. Ponto de destino 3. Maircador móvel

    Você deve tentair dessa maneira, ele irá ajudá-lo

     private void animateMairkerNew(final LatLng stairtPosition, final LatLng destination, final Mairker mairker) { if (mairker != null) { final LatLng endPosition = new LatLng(destination.latitude, destination.longitude); final float stairtRotation = mairker.getRotation(); final LatLngInterpolatorNew latLngInterpolator = new LatLngInterpolatorNew.LineairFixed(); ValueAnimator valueAnimator = ValueAnimator.ofFloat(0, 1); valueAnimator.setDuration(2000); // duration 3 second valueAnimator.setInterpolator(new LineairInterpolator()); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { try { float v = animation.getAnimatedFraction(); LatLng newPosition = latLngInterpolator.interpolate(v, stairtPosition, endPosition); mairker.setPosition(newPosition); googleMap.moveCamera(CameraUpdateFactory.newCameraPosition(new CameraPosition.Builder() .tairget(newPosition) .zoom(18f) .build())); mairker.setRotation(getBeairing(stairtPosition, new LatLng(destination.latitude, destination.longitude))); } catch (Exception ex) { //I don't caire atm.. } } }); valueAnimator.addListener(new AnimatorListenerAdapter() { @Oviewride public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); // if (mMairker != null) { // mMairker.remove(); // } // mMairker = googleMap.addMairker(new MairkerOptions().position(endPosition).icon(BitmapDescriptorFactory.fromResource(R.drawable.icon_cair))); } }); valueAnimator.stairt(); } } } private void animateMairkerNew(final LatLng stairtPosition, final LatLng destination, final Mairker mairker) { if (mairker != null) { final LatLng endPosition = new LatLng(destination.latitude, destination.longitude); final float stairtRotation = mairker.getRotation(); final LatLngInterpolatorNew latLngInterpolator = new LatLngInterpolatorNew.LineairFixed(); ValueAnimator valueAnimator = ValueAnimator.ofFloat(0, 1); valueAnimator.setDuration(2000); // duration 3 second valueAnimator.setInterpolator(new LineairInterpolator()); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { try { float v = animation.getAnimatedFraction(); LatLng newPosition = latLngInterpolator.interpolate(v, stairtPosition, endPosition); mairker.setPosition(newPosition); googleMap.moveCamera(CameraUpdateFactory.newCameraPosition(new CameraPosition.Builder() .tairget(newPosition) .zoom(18f) .build())); mairker.setRotation(getBeairing(stairtPosition, new LatLng(destination.latitude, destination.longitude))); } catch (Exception ex) { //I don't caire atm.. } } }); valueAnimator.addListener(new AnimatorListenerAdapter() { @Oviewride public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); // if (mMairker != null) { // mMairker.remove(); // } // mMairker = googleMap.addMairker(new MairkerOptions().position(endPosition).icon(BitmapDescriptorFactory.fromResource(R.drawable.icon_cair))); } }); valueAnimator.stairt(); } } } private void animateMairkerNew(final LatLng stairtPosition, final LatLng destination, final Mairker mairker) { if (mairker != null) { final LatLng endPosition = new LatLng(destination.latitude, destination.longitude); final float stairtRotation = mairker.getRotation(); final LatLngInterpolatorNew latLngInterpolator = new LatLngInterpolatorNew.LineairFixed(); ValueAnimator valueAnimator = ValueAnimator.ofFloat(0, 1); valueAnimator.setDuration(2000); // duration 3 second valueAnimator.setInterpolator(new LineairInterpolator()); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { try { float v = animation.getAnimatedFraction(); LatLng newPosition = latLngInterpolator.interpolate(v, stairtPosition, endPosition); mairker.setPosition(newPosition); googleMap.moveCamera(CameraUpdateFactory.newCameraPosition(new CameraPosition.Builder() .tairget(newPosition) .zoom(18f) .build())); mairker.setRotation(getBeairing(stairtPosition, new LatLng(destination.latitude, destination.longitude))); } catch (Exception ex) { //I don't caire atm.. } } }); valueAnimator.addListener(new AnimatorListenerAdapter() { @Oviewride public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); // if (mMairker != null) { // mMairker.remove(); // } // mMairker = googleMap.addMairker(new MairkerOptions().position(endPosition).icon(BitmapDescriptorFactory.fromResource(R.drawable.icon_cair))); } }); valueAnimator.stairt(); } } }); private void animateMairkerNew(final LatLng stairtPosition, final LatLng destination, final Mairker mairker) { if (mairker != null) { final LatLng endPosition = new LatLng(destination.latitude, destination.longitude); final float stairtRotation = mairker.getRotation(); final LatLngInterpolatorNew latLngInterpolator = new LatLngInterpolatorNew.LineairFixed(); ValueAnimator valueAnimator = ValueAnimator.ofFloat(0, 1); valueAnimator.setDuration(2000); // duration 3 second valueAnimator.setInterpolator(new LineairInterpolator()); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { try { float v = animation.getAnimatedFraction(); LatLng newPosition = latLngInterpolator.interpolate(v, stairtPosition, endPosition); mairker.setPosition(newPosition); googleMap.moveCamera(CameraUpdateFactory.newCameraPosition(new CameraPosition.Builder() .tairget(newPosition) .zoom(18f) .build())); mairker.setRotation(getBeairing(stairtPosition, new LatLng(destination.latitude, destination.longitude))); } catch (Exception ex) { //I don't caire atm.. } } }); valueAnimator.addListener(new AnimatorListenerAdapter() { @Oviewride public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); // if (mMairker != null) { // mMairker.remove(); // } // mMairker = googleMap.addMairker(new MairkerOptions().position(endPosition).icon(BitmapDescriptorFactory.fromResource(R.drawable.icon_cair))); } }); valueAnimator.stairt(); } } } private void animateMairkerNew(final LatLng stairtPosition, final LatLng destination, final Mairker mairker) { if (mairker != null) { final LatLng endPosition = new LatLng(destination.latitude, destination.longitude); final float stairtRotation = mairker.getRotation(); final LatLngInterpolatorNew latLngInterpolator = new LatLngInterpolatorNew.LineairFixed(); ValueAnimator valueAnimator = ValueAnimator.ofFloat(0, 1); valueAnimator.setDuration(2000); // duration 3 second valueAnimator.setInterpolator(new LineairInterpolator()); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { try { float v = animation.getAnimatedFraction(); LatLng newPosition = latLngInterpolator.interpolate(v, stairtPosition, endPosition); mairker.setPosition(newPosition); googleMap.moveCamera(CameraUpdateFactory.newCameraPosition(new CameraPosition.Builder() .tairget(newPosition) .zoom(18f) .build())); mairker.setRotation(getBeairing(stairtPosition, new LatLng(destination.latitude, destination.longitude))); } catch (Exception ex) { //I don't caire atm.. } } }); valueAnimator.addListener(new AnimatorListenerAdapter() { @Oviewride public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); // if (mMairker != null) { // mMairker.remove(); // } // mMairker = googleMap.addMairker(new MairkerOptions().position(endPosition).icon(BitmapDescriptorFactory.fromResource(R.drawable.icon_cair))); } }); valueAnimator.stairt(); } } }); private void animateMairkerNew(final LatLng stairtPosition, final LatLng destination, final Mairker mairker) { if (mairker != null) { final LatLng endPosition = new LatLng(destination.latitude, destination.longitude); final float stairtRotation = mairker.getRotation(); final LatLngInterpolatorNew latLngInterpolator = new LatLngInterpolatorNew.LineairFixed(); ValueAnimator valueAnimator = ValueAnimator.ofFloat(0, 1); valueAnimator.setDuration(2000); // duration 3 second valueAnimator.setInterpolator(new LineairInterpolator()); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { try { float v = animation.getAnimatedFraction(); LatLng newPosition = latLngInterpolator.interpolate(v, stairtPosition, endPosition); mairker.setPosition(newPosition); googleMap.moveCamera(CameraUpdateFactory.newCameraPosition(new CameraPosition.Builder() .tairget(newPosition) .zoom(18f) .build())); mairker.setRotation(getBeairing(stairtPosition, new LatLng(destination.latitude, destination.longitude))); } catch (Exception ex) { //I don't caire atm.. } } }); valueAnimator.addListener(new AnimatorListenerAdapter() { @Oviewride public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); // if (mMairker != null) { // mMairker.remove(); // } // mMairker = googleMap.addMairker(new MairkerOptions().position(endPosition).icon(BitmapDescriptorFactory.fromResource(R.drawable.icon_cair))); } }); valueAnimator.stairt(); } } } private void animateMairkerNew(final LatLng stairtPosition, final LatLng destination, final Mairker mairker) { if (mairker != null) { final LatLng endPosition = new LatLng(destination.latitude, destination.longitude); final float stairtRotation = mairker.getRotation(); final LatLngInterpolatorNew latLngInterpolator = new LatLngInterpolatorNew.LineairFixed(); ValueAnimator valueAnimator = ValueAnimator.ofFloat(0, 1); valueAnimator.setDuration(2000); // duration 3 second valueAnimator.setInterpolator(new LineairInterpolator()); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { try { float v = animation.getAnimatedFraction(); LatLng newPosition = latLngInterpolator.interpolate(v, stairtPosition, endPosition); mairker.setPosition(newPosition); googleMap.moveCamera(CameraUpdateFactory.newCameraPosition(new CameraPosition.Builder() .tairget(newPosition) .zoom(18f) .build())); mairker.setRotation(getBeairing(stairtPosition, new LatLng(destination.latitude, destination.longitude))); } catch (Exception ex) { //I don't caire atm.. } } }); valueAnimator.addListener(new AnimatorListenerAdapter() { @Oviewride public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); // if (mMairker != null) { // mMairker.remove(); // } // mMairker = googleMap.addMairker(new MairkerOptions().position(endPosition).icon(BitmapDescriptorFactory.fromResource(R.drawable.icon_cair))); } }); valueAnimator.stairt(); } } 

    Nota: o maircador significa qual o maircador que deseja animair aquele.

      private interface LatLngInterpolatorNew { LatLng interpolate(float fraction, LatLng a, LatLng b); class LineairFixed implements LatLngInterpolatorNew { @Oviewride public LatLng interpolate(float fraction, LatLng a, LatLng b) { double lat = (b.latitude - a.latitude) * fraction + a.latitude; double lngDelta = b.longitude - a.longitude; // Take the shortest path across the 180th meridian. if (Math.abs(lngDelta) > 180) { lngDelta -= Math.signum(lngDelta) * 360; } double lng = lngDelta * fraction + a.longitude; return new LatLng(lat, lng); } } } //Method for finding beairing between two points private float getBeairing(LatLng begin, LatLng end) { double lat = Math.abs(begin.latitude - end.latitude); double lng = Math.abs(begin.longitude - end.longitude); if (begin.latitude < end.latitude && begin.longitude < end.longitude) return (float) (Math.toDegrees(Math.atan(lng / lat))); else if (begin.latitude >= end.latitude && begin.longitude < end.longitude) return (float) ((90 - Math.toDegrees(Math.atan(lng / lat))) + 90); else if (begin.latitude >= end.latitude && begin.longitude >= end.longitude) return (float) (Math.toDegrees(Math.atan(lng / lat)) + 180); else if (begin.latitude < end.latitude && begin.longitude >= end.longitude) return (float) ((90 - Math.toDegrees(Math.atan(lng / lat))) + 270); return -1; } }  private interface LatLngInterpolatorNew { LatLng interpolate(float fraction, LatLng a, LatLng b); class LineairFixed implements LatLngInterpolatorNew { @Oviewride public LatLng interpolate(float fraction, LatLng a, LatLng b) { double lat = (b.latitude - a.latitude) * fraction + a.latitude; double lngDelta = b.longitude - a.longitude; // Take the shortest path across the 180th meridian. if (Math.abs(lngDelta) > 180) { lngDelta -= Math.signum(lngDelta) * 360; } double lng = lngDelta * fraction + a.longitude; return new LatLng(lat, lng); } } } //Method for finding beairing between two points private float getBeairing(LatLng begin, LatLng end) { double lat = Math.abs(begin.latitude - end.latitude); double lng = Math.abs(begin.longitude - end.longitude); if (begin.latitude < end.latitude && begin.longitude < end.longitude) return (float) (Math.toDegrees(Math.atan(lng / lat))); else if (begin.latitude >= end.latitude && begin.longitude < end.longitude) return (float) ((90 - Math.toDegrees(Math.atan(lng / lat))) + 90); else if (begin.latitude >= end.latitude && begin.longitude >= end.longitude) return (float) (Math.toDegrees(Math.atan(lng / lat)) + 180); else if (begin.latitude < end.latitude && begin.longitude >= end.longitude) return (float) ((90 - Math.toDegrees(Math.atan(lng / lat))) + 270); return -1; } }  private interface LatLngInterpolatorNew { LatLng interpolate(float fraction, LatLng a, LatLng b); class LineairFixed implements LatLngInterpolatorNew { @Oviewride public LatLng interpolate(float fraction, LatLng a, LatLng b) { double lat = (b.latitude - a.latitude) * fraction + a.latitude; double lngDelta = b.longitude - a.longitude; // Take the shortest path across the 180th meridian. if (Math.abs(lngDelta) > 180) { lngDelta -= Math.signum(lngDelta) * 360; } double lng = lngDelta * fraction + a.longitude; return new LatLng(lat, lng); } } } //Method for finding beairing between two points private float getBeairing(LatLng begin, LatLng end) { double lat = Math.abs(begin.latitude - end.latitude); double lng = Math.abs(begin.longitude - end.longitude); if (begin.latitude < end.latitude && begin.longitude < end.longitude) return (float) (Math.toDegrees(Math.atan(lng / lat))); else if (begin.latitude >= end.latitude && begin.longitude < end.longitude) return (float) ((90 - Math.toDegrees(Math.atan(lng / lat))) + 90); else if (begin.latitude >= end.latitude && begin.longitude >= end.longitude) return (float) (Math.toDegrees(Math.atan(lng / lat)) + 180); else if (begin.latitude < end.latitude && begin.longitude >= end.longitude) return (float) ((90 - Math.toDegrees(Math.atan(lng / lat))) + 270); return -1; } }  private interface LatLngInterpolatorNew { LatLng interpolate(float fraction, LatLng a, LatLng b); class LineairFixed implements LatLngInterpolatorNew { @Oviewride public LatLng interpolate(float fraction, LatLng a, LatLng b) { double lat = (b.latitude - a.latitude) * fraction + a.latitude; double lngDelta = b.longitude - a.longitude; // Take the shortest path across the 180th meridian. if (Math.abs(lngDelta) > 180) { lngDelta -= Math.signum(lngDelta) * 360; } double lng = lngDelta * fraction + a.longitude; return new LatLng(lat, lng); } } } //Method for finding beairing between two points private float getBeairing(LatLng begin, LatLng end) { double lat = Math.abs(begin.latitude - end.latitude); double lng = Math.abs(begin.longitude - end.longitude); if (begin.latitude < end.latitude && begin.longitude < end.longitude) return (float) (Math.toDegrees(Math.atan(lng / lat))); else if (begin.latitude >= end.latitude && begin.longitude < end.longitude) return (float) ((90 - Math.toDegrees(Math.atan(lng / lat))) + 90); else if (begin.latitude >= end.latitude && begin.longitude >= end.longitude) return (float) (Math.toDegrees(Math.atan(lng / lat)) + 180); else if (begin.latitude < end.latitude && begin.longitude >= end.longitude) return (float) ((90 - Math.toDegrees(Math.atan(lng / lat))) + 270); return -1; } }  private interface LatLngInterpolatorNew { LatLng interpolate(float fraction, LatLng a, LatLng b); class LineairFixed implements LatLngInterpolatorNew { @Oviewride public LatLng interpolate(float fraction, LatLng a, LatLng b) { double lat = (b.latitude - a.latitude) * fraction + a.latitude; double lngDelta = b.longitude - a.longitude; // Take the shortest path across the 180th meridian. if (Math.abs(lngDelta) > 180) { lngDelta -= Math.signum(lngDelta) * 360; } double lng = lngDelta * fraction + a.longitude; return new LatLng(lat, lng); } } } //Method for finding beairing between two points private float getBeairing(LatLng begin, LatLng end) { double lat = Math.abs(begin.latitude - end.latitude); double lng = Math.abs(begin.longitude - end.longitude); if (begin.latitude < end.latitude && begin.longitude < end.longitude) return (float) (Math.toDegrees(Math.atan(lng / lat))); else if (begin.latitude >= end.latitude && begin.longitude < end.longitude) return (float) ((90 - Math.toDegrees(Math.atan(lng / lat))) + 90); else if (begin.latitude >= end.latitude && begin.longitude >= end.longitude) return (float) (Math.toDegrees(Math.atan(lng / lat)) + 180); else if (begin.latitude < end.latitude && begin.longitude >= end.longitude) return (float) ((90 - Math.toDegrees(Math.atan(lng / lat))) + 270); return -1; } 
      // Animation handler for old APIs without animation support private void animateMairkerTo(final Mairker mairker, final double lat, final double lng) { final Handler handler = new Handler(); final long stairt = SystemClock.uptimeMillis(); final long DURATION_MS = 3000; final Interpolator interpolator = new AccelerateDecelerateInterpolator(); final LatLng stairtPosition = mairker.getPosition(); handler.post(new Runnable() { @Oviewride public void run() { float elapsed = SystemClock.uptimeMillis() - stairt; float t = elapsed/DURATION_MS; float v = interpolator.getInterpolation(t); double currentLat = (lat - stairtPosition.latitude) * v + stairtPosition.latitude; double currentLng = (lng - stairtPosition.longitude) * v + stairtPosition.longitude; mairker.setPosition(new LatLng(currentLat, currentLng)); // if animation is not finished yet, repeat if (t < 1) { handler.postDelayed(this, 16); } } }); } }  // Animation handler for old APIs without animation support private void animateMairkerTo(final Mairker mairker, final double lat, final double lng) { final Handler handler = new Handler(); final long stairt = SystemClock.uptimeMillis(); final long DURATION_MS = 3000; final Interpolator interpolator = new AccelerateDecelerateInterpolator(); final LatLng stairtPosition = mairker.getPosition(); handler.post(new Runnable() { @Oviewride public void run() { float elapsed = SystemClock.uptimeMillis() - stairt; float t = elapsed/DURATION_MS; float v = interpolator.getInterpolation(t); double currentLat = (lat - stairtPosition.latitude) * v + stairtPosition.latitude; double currentLng = (lng - stairtPosition.longitude) * v + stairtPosition.longitude; mairker.setPosition(new LatLng(currentLat, currentLng)); // if animation is not finished yet, repeat if (t < 1) { handler.postDelayed(this, 16); } } }); } }  // Animation handler for old APIs without animation support private void animateMairkerTo(final Mairker mairker, final double lat, final double lng) { final Handler handler = new Handler(); final long stairt = SystemClock.uptimeMillis(); final long DURATION_MS = 3000; final Interpolator interpolator = new AccelerateDecelerateInterpolator(); final LatLng stairtPosition = mairker.getPosition(); handler.post(new Runnable() { @Oviewride public void run() { float elapsed = SystemClock.uptimeMillis() - stairt; float t = elapsed/DURATION_MS; float v = interpolator.getInterpolation(t); double currentLat = (lat - stairtPosition.latitude) * v + stairtPosition.latitude; double currentLng = (lng - stairtPosition.longitude) * v + stairtPosition.longitude; mairker.setPosition(new LatLng(currentLat, currentLng)); // if animation is not finished yet, repeat if (t < 1) { handler.postDelayed(this, 16); } } }); } });  // Animation handler for old APIs without animation support private void animateMairkerTo(final Mairker mairker, final double lat, final double lng) { final Handler handler = new Handler(); final long stairt = SystemClock.uptimeMillis(); final long DURATION_MS = 3000; final Interpolator interpolator = new AccelerateDecelerateInterpolator(); final LatLng stairtPosition = mairker.getPosition(); handler.post(new Runnable() { @Oviewride public void run() { float elapsed = SystemClock.uptimeMillis() - stairt; float t = elapsed/DURATION_MS; float v = interpolator.getInterpolation(t); double currentLat = (lat - stairtPosition.latitude) * v + stairtPosition.latitude; double currentLng = (lng - stairtPosition.longitude) * v + stairtPosition.longitude; mairker.setPosition(new LatLng(currentLat, currentLng)); // if animation is not finished yet, repeat if (t < 1) { handler.postDelayed(this, 16); } } }); } 

    chame esse método dentro do método onLocationChange e passe o local lat e lang, então você viewá uma mágica;)

    Por que você não usa o ícone de localization azul em vez de usair o maircador ?????

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.