【问题标题】:Using Google Transit mode in Android Google map在 Android Google 地图中使用 Google Transit 模式
【发布时间】:2013-12-12 10:14:36
【问题描述】:

目前在谷歌地图应用程序中工作。我想在安卓应用程序中使用谷歌交通 API。我就是这样用的。

http://maps.googleapis.com/maps/api/directions/json?origin=77.589355,13.004558&destination=78.655758,11.253837&mode=transit&sensor=false&region=fr&departure_time=1387069950

什么是离开时间?我怎么能找到。我动态获取的所有详细信息(用户选择)。

<li>
    String url = "http://maps.googleapis.com/maps/api/directions/xml?" + 
                 "origin=" + start.latitude + "," + start.longitude + 
                 "&destination=" + end.latitude + "," + end.longitude + 
                 "&sensor =false &units=metric&mode=trnsit......."
</li>

我正在使用这个。

谁能帮帮我

  • 如何动态查找出发时间和
  • 我在哪里可以买到?

【问题讨论】:

    标签: android google-maps google-maps-api-3


    【解决方案1】:

    您要查找的格式是自 1970 年 1 月 1 日以来经过的秒数,有时称为“Unix 时间”。

    Date 类包括获取该值的getTime 方法。试试这样的:

    import java.util.*;
    
    Date departure = new Date();  // This is the current time for testing purposes
    
    String url = "http://maps.googleapis.com/maps/api/directions/xml?origin=" +
        start.latitude + "," + start.longitude + "&destination=" + end.latitude +
        "," + end.longitude + "&mode=transit&sensor=false&region=fr&departure_time=" +
        departure.getTime();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-09-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多