这是我使用改造错误的时候
第一步:
public interface RequestService { @POST ("home/indexThree") CallgetHomeinfo(@Body RequestBody info); }
第二步:
Retrofit retrofit = new Retrofit.Builder() .baseUrl(url) .addConverterFactory(GsonConverterFactory.create()) .build(); RequestService requestService = retrofit.create(RequestService.class); RequestBody body = RequestBody.create(JSON, jsonObject.toString()); Callhomeinfo = requestService.getHomeinfo(body); homeinfo.enqueue(new Callback () { @Override public void onResponse(Call call, Response response) { System.out.println("response"+response.body().toString()); } @Override public void onFailure(Call call, Throwable t) { System.out.println("onFailure"+t.getMessage().toString()); } });
我在网上搜索了很长时间.但没用.请帮助或尝试提供一些如何实现这一点的想法.谢谢!