I’m trying to draw a route in a mapView from the current location (got from GPS) to the way he travels.
I am able to fetch the location of the user as he moves in a particular direction, but I was not able to draw the path.
What is the best way to draw the route path as he moves from place to place continuously?
I want the method to be good (in terms of performance).
You will have to keep track of the current location & previous location (in global variable for example) in order to draw the path [except the first time you only have current location, so you do nothing until the next point].
This will be called in
draw()and you to somehow call this draw function through drawing overlay inonLocationChanged()function.note: canvas and mv are parameters passed to
draw()function and first is a global boolean variable to indicate this is the first point you get or not.