【发布时间】:2017-05-27 06:45:49
【问题描述】:
我正在开发一个天气应用程序,试图构建一个看起来像 内容://com.example.weather.app/Location/locationName?Date=12012017
文档说 Uri 引用的模式为 ://?#
试图理解以下代码
public static Uri buildWeatherLocation(String locationSetting) {
return CONTENT_URI.buildUpon().appendPath(locationSetting).build();
}
public static Uri buildWeatherLocationWithStartDate(
String locationSetting, long startDate) {
long normalizedDate = normalizeDate(startDate);
return CONTENT_URI.buildUpon().appendPath(locationSetting)
.appendQueryParameter(COLUMN_DATE,Long.toString(normalizedDate)).build();
}
实际区别是什么?我们何时使用appendPath() 和appendQueryParameter() 方法?
为什么我们不能使用appendQueryParameter() 进行位置设置,有点令人困惑的建议plz
【问题讨论】:
标签: android