I am able to retrieve new lat and long values on location update and update the new lat and long to their respective textviews as shown below:
private Polyline route = null;
private PolylineOptions routeOpts = null;
private boolean drawTrack = true;
private void updateUI() {
if (mCurrentLocation != null) {
tvLat.setText(String.valueOf(mCurrentLocation.getLatitude()));
tvLng.setText(String.valueOf(mCurrentLocation.getLongitude()));
tvUpdateTime.setText(mLastUpdateTime);
routeOpts = new PolylineOptions().color(Color.BLUE)
.width(3)
.geodesic(true);
route = mMap.addPolyline(routeOpts);
route.setVisible(drawTrack);
LatLng newPoint = new LatLng(mCurrentLocation.getLatitude(), mCurrentLocation.getLongitude());
List<LatLng> points = route.getPoints();
points.add(newPoint);
route.setPoints(points);
}
}
I was following this question here. What I want to do is on location update, a polyline will be drawn. So basically the polyline increases as the user moves while tracking their routes. The location in the textviews are updating, but the polyline is not appearing.