将改装响应传递给功能或复制它

pass retrofit response to a function or copy it

我要把这个改造**响应**传递给一个函数 有人知道吗:

  1. 如何将它传递给函数? 或

  2. 如何制作public? 或

  3. 如何复制:

    call.enqueue(新回调() {

             @Override
             public void onResponse(Call<GetAllJsonDatum> call, Response<GetAllJsonDatum> **response**) {
    

GetAllJsonDatum 是一个 class。我收到了更多的感谢 100000 条记录,我需要在后台处理这些数据,现在我需要访问它一个函数或使其 public 在 public 之外访问它 void onResponse(Call call , 响应响应) 或复制此回复; 谢谢

这是答案<仅用于将其传递给函数>: 只需创建一个这样的函数:

public void getMyResponse(Response<GetAllJsonDatum> response){
      // now do whatever you want with response.body() -- :)
}

在你的改造 onResponse() 中调用:

getMyResponse(response);

仅此而已;