[英]How get duration in mins from a marker another google maps
我如何在Google地圖中獲取MINS從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");
尋求幫助
參考下面的鏈接google提供方向api,它提供了有關從源到目的地的所有信息。 閱讀這一切,您將獲得問題解決方案。 https://developers.google.com/maps/documentation/directions/start
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.