0
votes

I'm going to pass this retrofit **response ** to a function does somebody know :

  1. how to pass it to a function ? or

  2. how to make it public ? or

  3. how can I copy it :

    call.enqueue(new Callback() {

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

GetAllJsonDatum is a class. I'm receiving more thank 100000 records and I need to work on these data in background , Now I need to access it a function or make it public to access it outside of public void onResponse(Call call, Response response) or make a copy of this response; thanks

1
what's the problem with passing the response and what approaches have you taken? - momt99
GetAllJsonDatum is a class , I got my json response in it , response has more than 100000 records and I'm planning to work on it in the background, so I need need to access it in my function , this response is not public and i cant access it outside of onResponse() - a a

1 Answers

0
votes

here is the answer <only for passing it to a function> : just make a function like this:

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

inside your retrofit onResponse() just call :

getMyResponse(response);

that's All;