Android Polyline - Adding point by point

后端 未结 1 2056
不思量自难忘°
不思量自难忘° 2021-02-14 23:58

I\'m currently having a map, and each 10 meters I use LocationListener to refresh my location and get the new Latitude and Longitude. Now I wish that the route the user is takin

1条回答
  •  死守一世寂寞
    2021-02-15 00:29

    First translate Location into LatLng:

    LatLng newPoint = new LatLng(location.getLatitude(), location.getLongitude());
    

    Then add a point to existing list of points:

    List points = lineRoute.getPoints();
    points.add(newPoint);
    lineRoute.setPoints(points);
    

    0 讨论(0)
提交回复
热议问题