Loïc Monard
Loïc Monard

Reputation: 690

How to make my marker move each second

I'm building a Xamarin Android app, I have a list of LatLng position and I want to move my marker every second, at each position of my list...

Do you have any idea of how to implement that ? Thank you

Upvotes: 1

Views: 57

Answers (1)

Thibault Cam
Thibault Cam

Reputation: 48

First of all create a Timer =>

timer = new Timer();
timer.Interval = 200;
timer.Enabled = true;
timer.Elapsed += OnMarkerMoving;
timer.Start();

And in your OnMarkerMoving method =>

public void OnMarkerMoving() 
{
     count++
     if(count < positionList.Count) 
     {
        yourMarker.Position = positionList[count];
     } else
        timer.Dispose();
}

Upvotes: 3

Related Questions