How to run a code when all threads are done
<p>I am new to threading and i went through many post in stack overflow and find many solution for my problem but i am not sure which one is best for which condition. </p>

<blockquote>
  <p>First thing first, my problem is that i want to update one JSON file
  when all threads are done with the bitmap generation at a specific path so
  that i can get that all those image and update JSON file. So in
  simple word my i want to run some code when all thread are done with it
  execution and major requirement is that i don't want my main to be blocked because of this.</p>
</blockquote>

<p><strong>What i have found out</strong></p>

<ul>
<li>thread. join </li>
<li>excutorServive </li>
<li>android-priority-jobQueue <a href="https://github.com/path/android-priority-jobqueue/tree/master/examples/twitter/TwitterClient" rel="nofollow">(link)</a></li>
<li>Mutex in threadpool ( also let me know if any other is there)</li>
</ul>

<blockquote>
  <p>I am confused which one is the best way to tackle my problem. if any
  android expert out there can <strong>summarise that for following the two
  scenerio what is the best available in android.</strong></p>
</blockquote>

<ul>
<li>wait till when all thread completes</li>
<li>don't wait and get informed when all completes</li>
</ul>