我在@GET中遇到多个参数的问题。如果我有两个,一切都运行正常,但如果我有三个(我需要三个)它跳过onResponse方法和onFailure执行。有谁知道为什么?
这是界面
@GET("CalendarJson")
Call<List<Raspored>> getKalendar(
@Query("department") String department,
@Query("semester") String semester,
@Query("year") int year);
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(basicUrl)
.addConverterFactory(GsonConverterFactory.create())
.build();
KalendarService kalendarService = retrofit.create(KalendarService.class);
这就是我称之为的地方
KalendarService.kalendarService.getKalendar(department,semester,year).enqueue(new Callback<List<Raspored>>() {
@Override
public void onResponse(Call<List<Raspored>> call, Response<List<Raspored>> response) {
if(response.isSuccessful()){
raspored = response.body();
//TODO
}
}
@Override
public void onFailure(Call<List<Raspored>> call, Throwable t) {
Toast.makeText(getApplicationContext(), "Failure", Toast.LENGTH_SHORT).show();
}
});
答案 0 :(得分:0)
我认为它与你的第三个参数
的数据类型有关