I have two calls (Call) of Retrofit 2, one that downloads a object of type Config, and one that downloads a list of objects of type Registrations.
I need to know when these two calls are finished, so I can call a new activity
, however, if I put two variables of type boolean
in onResponse
of each of the two calls to perform a test like: / p>
if(var1 && var2 == true){
//Código para abrir a nova activity
}
When the code comes to the test, the calls have not yet received the response from the server, causing the two variables to be false
, not starting Activity
. How can I make this code to open the new activity
run only after the two calls are completed?