簡體   English   中英

如何從另一個Google地圖的標記獲取以分鍾為單位的持續時間

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM