Android Polyline - Adding point by point

后端 未结 1 836
伪装坚强ぢ
伪装坚强ぢ 2021-02-15 00:04

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:35

    First translate Location into LatLng:

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

    Then add a point to existing list of points:

    List<LatLng> points = lineRoute.getPoints();
    points.add(newPoint);
    lineRoute.setPoints(points);
    
    0 讨论(0)
提交回复
热议问题