Android - 翻新 - 查询 - 雅虎天气

问题描述:

我正在尝试使用Retrofit向Yahoo请求当前天气。 我在通过城市时遇到了一个问题。我知道我必须使用@QueryAndroid - 翻新 - 查询 - 雅虎天气

雅虎查询有点复杂,我不知道如何继续。 这里是我的代码

@GET("yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20**text%3D%22brussels%2C%20be%22)%20and%20u%3D%27c%27&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys") 

在这种复杂的查询,我需要更新从城市参数 文本%3D%22brussels%2C%20be文本%3D%巴黎%2C%20FR例如。

任何帮助将不胜感激;

由于提前,

@GET("yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20**text%3D%22{location}%2C%20be%22)%20and%20u%3D%27c%27&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys") 
Call<response> groupList(@Path("location") String location); 

如果我正确理解你的问题,这应该工作。

+0

谢谢Tim。所以我在我的活动中,我需要通过城市变量,但这是我卡住的地方。如果我以这种方式传递:WeatherAPI.Factory.getmWeatherAPI()。getWeather(city).enqueue(new Callback - 据说我必须使用查询: - /这里是消息:不能有替换块。动态查询参数使用@Query。 – Isabelle