In my application, requests are executed at once for the entire list, how can you make them run as if they were chained? At first it was executed for the 1st element, after it was executed, it starts being executed for the second.
private void loadJSON() { Call<List<Integer>> call = request.getTopStories(); call.enqueue(new Callback<List<Integer>>() { @Override public void onResponse(Call<List<Integer>> call, Response<List<Integer>> response) { topStories = response.body(); loadDetails(); } @Override public void onFailure(Call<List<Integer>> call, Throwable t) { Toast.makeText(MainActivity.this, R.string.error, Toast.LENGTH_LONG).show(); } }); } private void loadDetails(){ for (Integer id : topStories) { request.getTopStore(id).enqueue(new Callback<Model>() { @Override public void onResponse(Call<Model> call, Response<Model> response) { models.add(response.body()); topStoriesAdapter.notifyDataSetChanged(); } @Override public void onFailure(Call<Model> call, Throwable t) { Toast.makeText(MainActivity.this, R.string.error, Toast.LENGTH_LONG).show(); } }); } }