我如何获取MINS从Google地图中的A点到B点的行车时间,下面附上我的代码片段:
Location locationB = new Location("point B");
locationB.setLatitude(location.getLatitude());
locationB.setLongitude(location.getLongitude());
distance = locationA.distanceTo(locationB);
double kms = distance / 1000 ;
String distanceKm = new DecimalFormat("#.0").format(kms);
Log.v("log", "distance " + distance);
tv3.setText(distanceKm + "Kms");
想获得帮助
答案 0 :(得分:0)
请参阅以下链接google提供方向api,它提供了有关从源到目的地的所有信息。阅读这一切,您将获得问题解决方案。 https://developers.google.com/maps/documentation/directions/start