title: Android: How to Make For Loop Continue Loop After AsyncTask is finish (onPostExecute)
body: <p>I have a value more than 1, so I planned to make a for loop to execute for each value. The problem is the for loop is looping/continue even the AsyncTask is not finish yet.</p>
  
  <p><strong>AsyncTask Class</strong></p>
  
  <pre><code>public class Server extends AsyncTask&lt;JSONObject, Void, Void&gt; {
  
     @Override
     protected Void doInBackground(JSONObject... params) {
         .........
     }
  
     @Override
     protected void onPostExecute(Void result) {
         .........
     }
  }
  </code></pre>
  
  <p><strong>Activity</strong></p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_a);
  
      for(int i=0; i&lt;10; i++){
         Server  myServer = new Server();
         myServer.execute(i);
      }
  }
  </code></pre>