Answer the question
In order to leave comments, you need to log in
How to make a delay after executing requests?
Good afternoon.
I do two asynchronous requests (Retrofit).
The code is placed in the button click handler.
You need to wait for the two enqueue() to complete, make a delay (while the progress bar is displayed) and finally execute the method that takes the parameters changed when the two enqueue() requests are executed.
How to make a delay?
Answer the question
In order to leave comments, you need to log in
In Java, starting from the eighth version, there is such a thing as Future and their execution queues.
If the version of android you are running supports them, then this is your most obvious decision.
In a more general case, such a queue can be organized independently.
We launched streams, each of them has an empty array (list, circular buffer, whatever) as a parameter, where they write their result.
In the loop, check your filling conditions and as soon as they satisfy you, then exit the loop.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question