2013-12-12 18 views
0

當前在Google Map App中工作。我想在Android應用程序中使用Google transit API。我正在使用這樣的。在Android中使用Google Transit模式Google地圖

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

什麼是DEPARTURE_TIME?我怎麼找到。所有我動態獲取的細節(用戶選擇)。

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

這個我正在使用。

任何人都可以請幫我

  • 我如何才能找到動態發車時間和
  • 我在哪裏可以買到?

回答

0

您正在查找的格式是自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(); 
相關問題