Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/323.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/228.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何使用改型从JSON响应中获取列表_Java_Android_Api_Retrofit - Fatal编程技术网

Java 如何使用改型从JSON响应中获取列表

Java 如何使用改型从JSON响应中获取列表,java,android,api,retrofit,Java,Android,Api,Retrofit,如何从json响应中获取列表?我已经从json对象中获取了一些数据,但不是从列表中获取的,我不知道该怎么做 原料药 reotrofit onResponse方法的具体外观如何?例如,您希望从列表中获取哪些数据?天哪,再次忘记添加响应,对此表示抱歉。我只想要图标数据。Android Studio不提供onResponse的代码完整性吗?例如,您希望从列表中获取哪些数据?天哪,再次忘记添加响应,对此表示抱歉。我只想要图标数据。安卓Studio不提供onResponse的代码完整性吗? @GET("w

如何从json响应中获取列表?我已经从json对象中获取了一些数据,但不是从列表中获取的,我不知道该怎么做

原料药


reotrofit onResponse方法的具体外观如何?

例如,您希望从列表中获取哪些数据?天哪,再次忘记添加响应,对此表示抱歉。我只想要图标数据。Android Studio不提供onResponse的代码完整性吗?例如,您希望从列表中获取哪些数据?天哪,再次忘记添加响应,对此表示抱歉。我只想要图标数据。安卓Studio不提供onResponse的代码完整性吗?
@GET("weather")
Call<List<Model>> getNewestForecast(
        @Query("lat") Double latitude,
        @Query("lon") Double longitude,
        @Query("appid") String key);
@SerializedName("weather")
private List<Weather> weather;

public List<Weather> getWeather() {
    return weather;
}

class Weather{
    @SerializedName("icon")
    private String forecastIcon;

    public String getForecastIcon() {
        return forecastIcon;
    }
}
"weather": [
{
  "id": 520,
  "main": "Rain",
  "description": "light intensity shower rain",
  "icon": "09n"
}
 ]