Answer the question
In order to leave comments, you need to log in
What is the correct way to send a request to Retrofit2?
I am getting an array after a retrofit FirstArray request, in this array I am getting a list of strings. Each of these rows needs to be sent as a request to another retrofit request, after which I get a SecondArray. How to iterate through the FirstArray array to get the ThirdArray like in the picture?
I am getting an array after a retrofit FirstArray request, in this array I am getting a list of strings. Each of these rows needs to be sent as a request to another retrofit request, after which I get a SecondArray. How to iterate through the FirstArray array to get the ThirdArray like in the picture? enter image description here
This is my first experience with Android Studio on java. Please don't throw stones
Call<List<FirstArrResponse>> firstArrResponseCall = ArrClient.getUserService().adDat(firstArrRequest);
firstArrResponseCall.enqueue(new Callback<List<FirstArrResponse>>() {
@Override
public void onResponse(@NotNull Call<List<FirstArrResponse>> call, @NotNull Response<List<FirstArrResponse>> response) {
if(response.isSuccessful()){
List<FirstArrResponse> irstArrResponses = response.body();
for (FirstArrResponse firstArrResponse : firstArrResponses){
//здесь получаю FirstArray
adapterArr.setData(firstArrResponses);
list_rv.setAdapter(adapterArr);
Answer the question
In order to leave comments, you need to log in
The easiest way is to use RxJava for this. flatMap.
Or just run N requests with your hands and glue the answers together. There is nothing specific to this task in the retrofit itself.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question