How to make so that the requests are not sent at the same time but sequentially, until the answer to the previous request is received (no matter which one is allowed to load the image via url) the next one is not sent?

There is an array of data (url'y pictures), you need to run through it and get all the pictures sequentially, use the cycle {new Thread (new Runnable () {public void run () {...}}} but this scheme as I understand it almost simultaneously performs all requests ....

    3 answers 3

    In your case, it is convenient to use ExecutorService.

    ExecutorService service = Executors.newSingleThreadExecutor(); for(int i = 0; i < 10; i++) { service.submit(new Runnable() { public void run() { ... } }); } 

      You can use IntentService , it will just do everything strictly in turn and in the selected stream.

        Create a separate thread and perform synchronous requests in the stream, rather than asynchronous (then the next one will not be executed until the previous request is completed).