Java 未调用改装中的onResponse方法
这是我的json响应:Java 未调用改装中的onResponse方法,java,android,retrofit,jsonresponse,Java,Android,Retrofit,Jsonresponse,这是我的json响应: { "details": [ { "id": "25", "name": "abc", "charges": "" } ] } 这是我的根类: public class Root { private Arr
{
"details": [
{
"id": "25",
"name": "abc",
"charges": ""
}
]
}
这是我的根类:
public class Root
{
private ArrayList<details> details;
public void setDetails(ArrayList<details> details){
this.details = details;
}
public ArrayList<details> getDetails(){
return this.details;
}
}
这是我在班上打的电话:
Call<Root> call2 = apiInterface.getDetails("json",id, token);
call2.enqueue(new Callback<Root2>() {
@Override
public void onResponse(Call<Root> call2, Response<Root> response2) {
Toast.makeText(getActivity(),"I am in",Toast.LENGTH_LONG).show();
}
@Override
public void onFailure(Call<Root> call2, Throwable t) {
Toast.makeText(getActivity(), t.getMessage(), Toast.LENGTH_LONG).show();
}
});
}
调用call2=apinterface.getDetails(“json”、id、令牌);
call2.enqueue(新回调(){
@凌驾
public void onResponse(调用call2,响应response2){
Toast.makeText(getActivity(),“我在”,Toast.LENGTH_LONG.show();
}
@凌驾
失败时公共无效(调用调用2,可丢弃的t){
Toast.makeText(getActivity(),t.getMessage(),Toast.LENGTH_LONG).show();
}
});
}
这是我的API接口类:
@GET("details")
Call<Root2> getDetails(@Query("format") String format, @Query("user_id") String user_id, @Query("token") String token);
@GET(“详细信息”)
调用getDetails(@Query(“format”)String format、@Query(“user\u id”)String user\u id、@Query(“token”)String token);
onResponse没有被调用,有人能告诉我我的代码有什么问题吗?我的pojo类是否不正确
@GET("details")
Call<Root2> getDetails(@Query("format") String format, @Query("user_id") String user_id, @Query("token") String token);