2016-05-30 26 views
-1

從Udacity開發的Android應用場 (陽光APP)getStartDateFromUri(Udacity陽光應用程序 - 第4課的ContentProvider)

第4課的ContentProvider

from this link at line 160

public static long getStartDateFromUri(Uri uri) { 
         String dateString = uri.getQueryParameter(COLUMN_DATE); 
         if (null != dateString && dateString.length() > 0) 
          return Long.parseLong(dateString); 
         else 
          return 0; 
         } 

其中COLUMN_DATE =「date」

getStartDateFromUri函數總是返回0 ...

可以請你告訴我,當它不會返回0? 如果可能的話給我一個URI來嘗試

我試圖

content://com.example.android.sunshine.app/weather/ 
content://com.example.android.sunshine.app/weather/94074 
content://com.example.android.sunshine.app/weather/94074/20140612 

問候

回答

0

根據題爲「創建內容供應商」內容提供商課的第二個視頻,日期參數是unix時間戳的形式。 試用

content://com.example.android.sunshine.app/weather/94074/1464566400 
+0

我仍然得到0 ... – McVaLs21

相關問題