title: JavaRx on Android: Observe if multiple files have downloaded
body: <p>I have an ArrayList of articles, where each article contains an image url.</p>
  
  <p>Also I have function downloadImage(url), which downloads and saves an image from an url to the device.</p>
  
  <p>Now I want to download all images for every article (every download in it's own thread?) and proceed action when all images are downloaded.</p>
  
  <p>How can I do that with RX?</p>
  
  <p>Thanks!</p>
  
  <p>Edit:
  Thanks to Dave for the answer. It did the trick, but there is one thing I have to correct: if you have a non-iterable object (like Article is in my case) you need to use Observable.just() instead of Observable.from().</p>
  
  <pre><code>Observable
  .from(articles)
  .flatMap(article -&gt; 
      Observable
          .just(article)
          .doOnNext(a -&gt; downloadImage(a.imageUrl))
          .subscribeOn(Schedulers.io())
  )
  .doOnError(t -&gt; logError(t))
  .subscribe();
  </code></pre>