DevBytes: Maphacks - Animating Markers

Android Developers · 61K views · 2013 · 8:20

Open on YouTube

Software (other)Web developmenttutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it as the official Google demo and source for smoothly moving a Google Maps marker from one LatLng to another.

Recommended by 9 people across 9 different months, 2013 to 2017.

What it is

An eight-minute Android Developers DevBytes episode in which Chris Broadfoot and Ankur Kotwal demonstrate techniques for animating markers on Google Maps for Android, using interpolators and evaluators. It also shows how a plotted path differs on the map surface versus the surface of the earth, with sample code on GitHub.

What people said

Strong rec DiscDev · 2013-02 · Stack Overflow · on “Animating markers on Google Maps v2”

Some Google engineers have provided a nice demo video with some elegant sample code about how to animate markers from a starting point to an ending point, for all various versions of Android: The relevant code is here: [LINK] And a nice demo video of all of it in action. [this video] OLD DEPRECATED ANSWER BELOW In the documentation, it is mentioned that Marker Icons cannot be changed: Icon A bitmap that's displayed for the marker. If the icon is left unset, a default icon is displayed. You can specify an alternative coloring of the default icon using defaultMarker(float). You can't change the icon once you've created the marker. Google Maps API v2 Documentation [LINK] You're going to have to keep

Strong rec Shishir Shetty · 2015-06 · Stack Overflow · on “How to move marker in googlemap while getting different latitude,longitude in android”

Some Google engineers have provided a nice demo video with some elegant sample code about how to animate markers from a starting point to an ending point, for all various versions of Android: The relevant code is here: [LINK] And a nice demo video of all of it in action. [this video] OLD DEPRECATED ANSWER BELOW In the documentation, it is mentioned that Marker Icons cannot be changed: Icon A bitmap that's displayed for the marker. If the icon is left unset, a default icon is displayed. You can specify an alternative coloring of the default icon using defaultMarker(float). You can't change the icon once you've created the marker. Google Maps API v2 Documentation You're going to have to keep track

Recommends CommonsWare · 2014-04 · Stack Overflow · on “How to animate a marker through an ArrayList of LatLng points?”

Well, what you're asking for is a bit complicated for a StackOverflow question -- it's a few pages in a book [LINK] . The technique comes from this DevBytes YouTube video [this video] , which will review the `LatLngEvaluator` and such.

Recommends N Dorigatti · 2015-06 · Stack Overflow · on “How can I animate a Marker when I put it on the map?”

There is this good video that shows markers animations: [this video] You can't animate the "Marker View" itself because it not accessible

Recommends Jerome · 2015-07 · Stack Overflow · on “Android - Changing position of a marker dynamically with google maps api”

You can use this to move the marker with animation use this: /** * @param marker the operation marker * @param finalPosition the destination latlng * @param latLngInterpolator interpolator of animation */ static void animateMarkerToICS(Marker marker, LatLng finalPosition, final LatLngInterpolator latLngInterpolator) this is the code: [LINK] and the video: [this video]

Recommends blackkara · 2016-04 · Stack Overflow · on “is it possible to emulate a moving point through a polyline?”

doing an app with a polyline and i want to emulate a car moving through the polyline...is it possible? Yes possible, you can move a marker between points, look this [LINK] I don't have a gps device, or is it posible to receive coordinates from another android device and use it as a gps? how can I achieve this? I don't understand what you mean, but If you wanna use phone or tablet as a gps device, they have already gps module. If you wanna use standalone gps tracker device and send location data to mobile device, AFAIK there is bluetooth gps modules/devices, so you can use it. EDIT I suggest watching this [this video] . In this video marker is being moved between two points, so you can move your m

Recommends ReyAnthonyRenacia · 2016-10 · Stack Overflow · on “Marker shaky on adding animation google maps android”

Try using the AccelerateDecelerateInterpolator [LINK] , an interpolator whose rate of change starts and ends slowly but accelerates through the middle, instead of LinearInterpolator as used in this Google video tutorial [this video] . The marker animation was seamless. Here's the snippet: public class MarkerAnimation { static void animateMarkerToGB(final Marker marker, final LatLng finalPosition, final LatLngInterpolator latLngInterpolator) { final LatLng startPosition = marker.getPosition(); final Handler handler = new Handler(); final long start = SystemClock.uptimeMillis(); final Interpolator interpolator = new AccelerateDecelerateInterpolator(); final float durationInMs = 3000; handler.post(n

Recommends ReyAnthonyRenacia · 2016-11 · Stack Overflow · on “Moving Marker Missing”

Try following the video demo by Google devs in this [this video] . The full source code is in this Github repo [LINK] . Hope that helps.

Recommends Saira · 2017-03 · Stack Overflow · on “Move marker with gps in google map android”

If you're still looking for the solution, hope this [this video] will help you. I've used this in one of my apps and it helps animating the marker from one location to other location. Source code can be grabbed here [LINK] . You might need to add rotation to your marker to show the exact direction of the marker. Following is the block of code that I'm using to find bearing. private float bearingBetweenLatLngs(LatLng begin, LatLng end) { Location beginL = convertLatLngToLocation(begin); Location endL = convertLatLngToLocation(end); return beginL.bearingTo(endL); }

Recommends Rehan Sarwar · 2017-07 · Stack Overflow · on “Displaying marker without jumping on the screen”

Check this official video of Maphacks-Animating Markers [this video] . you can also find source code on this Github link [LINK]