0
我新的开始与改造,当我试图让数据的形式API使用Retrofit2 + Rxjava:
ApiService :
@GET("news/get_comments/{newsid}/{count}/{offset}")
Observable<ResultResponse<CommentList>> getComment(@Header("api_key") String key, @Path("newsid") String newsid, @Path("count")String count, @Path("offset")String offset);
public void getComment(String item_id, int pageNow) {
int offset = (pageNow - 1) * 10;
Log.i("commentlist", offset+"");
Log.i("commentlist",pageNow+"");
addSubscription(AppClient.getApiService().getComment(ApiService.KEY,item_id,"10",offset+""), new SubscriberCallBack<CommentList>() {
@Override
protected void onSuccess(CommentList response) {
Logger.i("commentist",response.toString());
mvpView.onGetCommentSuccess(response);
}
});
}
GSON抛出一个错误:com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 41 path $.data
添加你要回来的JSON。另外,添加你创建的ResultResponse和CommentList对象 – TooManyEduardos