【发布时间】:2018-08-20 18:25:40
【问题描述】:
我正在尝试显示 5 天的天气预报,但 openweathermap 为我提供了 5 天/3 小时的天气。我想做的是只显示 15:00 的天气。
我正在使用带有日期和时间之一的 if 语句,如果您看到我的模拟器,它会多次显示相同的日期和时间,并将整个 JSON 文件显示为空文本。请问对此有什么想法吗?
这是我的 if 语句
if(weatherFor.dt_txt=="2018-08-21 00:00:00") {
holder?.view?.textWeatherDataForecast?.text = "${weatherFor.weather.map { it.description }.joinToString(",")} on ${date}"
holder?.view?.tempTextForecast?.text = weatherFor.main.temp.toString() + "°C"
}
【问题讨论】:
-
您能粘贴一个示例响应吗?
-
@karthikprasad 你是什么意思?(对不起,我是新手)
-
你能分享你的 ForecastWeatherList 对象吗?
标签: android json if-statement kotlin openweathermap